Difference between revisions of "Mu"

From Mailutils
Jump to navigationJump to search
Line 182: Line 182:
  
 
== 2047 ==
 
== 2047 ==
Decodes or encodes email message headers.
+
The <tt>mu 2047</tt> command is a filter for decoding or encoding email message headers formatted in accordance with [http://www.faqs.org/rfcs/rfc2047.html RFC 2047].  By default, it operates in encode mode and assumes the _iso-8859-1_ encoding.  If arguments are supplied in the command line, they are treated as the text to operate upon.  Otherwise the command acts as a UNIX filter, reading lines from the standard input and printing results on the standard output:
 +
 
 +
For examle:
 +
 
 +
  $ mu 2047 'Keld Jørn Simonsen <keld@dkuug.dk>'
 +
  =?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= <keld@dkuug.dk>
 +
 
 +
The decode mode can be requested via the <tt>--decode</tt> (<tt>-d</tt>) option:
 +
 
 +
  $ mu 2047 --decode '=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= <keld@dkuug.dk>'
 +
  Keld Jørn Simonsen <keld@dkuug.dk>
 +
 
 +
The <tt>--charset</tt> (<tt>-c</tt>) option changes the default character set, e.g.:
 +
 
 +
  $ mu 2047 --charset=utf-8 'Keld Jørn Simonsen <keld@dkuug.dk>'
 +
  =?utf-8?Q?Keld J=C3=B8rn Simonsen <keld@dkuug.dk>?=
 +
 
 +
This option is meaningful both in decode and in encode modes.  In decode mode it instructs the utility to convert the output to the given character set.  In encode mode it indicates the encoding of the input data, which will be reflected in the resulting string:
 +
 
 +
  $ quoted-printable
 +
 
 +
The <tt>--encoding</tt> (<tt>-E</tt>) option can be used in encode mode to change the output encoding.  Valid arguments for this option are: <tt>quoted-printable</tt> (the default) or <tt>base64</tt>.
 +
 
 +
The <tt>--newline</tt> (<tt>-n</tt>) option prints an additional newline character after each line of output.
  
 
== filter ==
 
== filter ==

Revision as of 12:07, 30 October 2011

Note: This article is not yet finished

Mu is a multi-purpose tool shipped with Mailutils. It can be used for various mail- and database-related tasks, as well as an auxiliary tool for compiling and linking programs with Mailutils.

Syntax

Mu is a command line tool. Its invocation syntax is:

mu [options] command [args]

where options are options that affect the behavior of mu as a whole, command instructs it what it is to do and args are any arguments the command needs in order to be executed.

The commands are:

2047
Decodes or encodes email message headers.
acl
Tests Mailutils access control lists;
cflags
Shows compiler options needed to compile with Mailutils.
dbm
Invokes a DBM management tool.
filter
Applies a chain of filters to the input.
help
Displays a terse help summary.
imap
Invokes an IMAP4 client shell (in development).
info
Displays information about Mailutils compile-time configuration.
ldflags
Constructs a ld(1) command line for linking a program with Mailutils.
logger
Logs information using Mailutils log facility.
pop
Invokes a POP3 client shell.
query
Queries configuration values.
wicket

Scans wickets for matching URLs

help

The mu help command lists all available options and command names along with short descriptions of what each of them does. It is similar to the mu --help option.

A command name can be supplied as an argument to help, in which case it will display a help page for that particular command, e.g.:

 mu help ldflags

will output help for the ldflags command. It is synonymous to the --help option used with that particular command, e.g.: mu ldflags --help.

info

The mu info command displays information about Mailutils compile-time configuration. In normal form its output lists a single configuration flag per line, e.g.:

 $ mu info
 VERSION=2.99.93
 SYSCONFDIR=/etc
 MAILSPOOLDIR=/var/mail/
 SCHEME=mbox
 LOG_FACILITY=mail
 IPV6
 USE_LIBPAM
 HAVE_LIBLTDL
 WITH_GDBM
 WITH_GNUTLS
 WITH_GSASL
 ...

A configuration flag can consist either of a single word, indicating that a particular capability has been enabled at compile time, or of a keyword/value pair delimited by an equal sign, which indicates a particular value used by default for that feature. For example, IPV6 means that Mailutils was compiled with support for IPv6, whereas SYSCONFDIR=/etc means that the default place for configuration files is in /etc directory.

Such short output is convenient for using mu info in scripts to decide whether it is possible to use a given feature. To assist human users, the --verbose (-v) option is provided. It prints a short description next to each flag:

 $ mu info --verbose
 VERSION=2.99.93           - Version of this package
 SYSCONFDIR=/etc           - System configuration directory
 MAILSPOOLDIR=/var/mail/   - Default mail spool directory
 SCHEME=mbox               - Default mailbox type
 LOG_FACILITY=mail         - Default syslog facility
 IPV6                      - IPv6 support
 USE_LIBPAM                - PAM support
 HAVE_LIBLTDL              - a portable `dlopen' wrapper library
 WITH_GDBM                 - GNU DBM
 WITH_GNUTLS               - TLS support using GNU TLS
 WITH_GSASL                - SASL support using GNU SASL
 ...

cflags

The mu cflags command shows compiler options needed to compile a C source with Mailutils. It is intended for use in configuration scripts and Makefiles, e.g.:

 CFLAGS=-g -O2 `mu cflags`

ldflags

The mu ldflag command is a counterpart of cflags used for linking. It constructs a ld(1) command line for linking a program with Mailutils.

When used without arguments, it outputs ld arguments which would link only with the core Mailutils library libmailutils:

 $ mu ldflags
 -L/usr/local/lib -lmailutils 

This command accepts a number of keywords which allow to select a particular subset of Mailutils libraries to link with. In particular, the argument all instructs it to link in all available libraries:

 $ mu ldflags all
 -L/usr/local/lib -lmu_mbox -lmu_mh -lmu_maildir -lmu_imap -lmu_pop \
 -lmu_mailer -lmu_compat -lmailutils -lmu_auth -lgsasl -lgnutls -lgcrypt \
 -lldap -lgnuradius -lpam -ldl 

Other available keywords are:

mbox
Link in the UNIX mbox format support.
mh
Link in the MH format support.
maildir
Link in the Maildir format support.
imap
Link in the IMAP protocol support.
pop
Link in the POP protocol support.
nntp
Link in the NNTP protocol support.
mailer
Enable support for mailers.
sieve
Link in the support for Sieve mail filtering language.
dbm
Link in the support for DBM databases (libmu_dbm library).
compat
Provide a compatibility layer for Mailutils 2.x.
auth
Link in the Mailutils authentication library.
guile
Provide Guile language bindings.
python
Provide Python language bindings.
cfg
Link in the Mailutils configuration library.
argp
Link in the library for command line parsing.

query

The mu query command queries values from Mailutils configuration files. It takes one or more configuration paths as its arguments. On output, it displays the values it found, each value on a separate line. If the requested value is a block statement it is displayed in full. For example, if main configuration file contained:

  logging {
    syslog yes;
    facility mail;
  };

Then:

 $ mu query .logging.syslog
 syslog yes;
 $ mu query .logging.syslog .logging.facility
 syslog yes;
 facility mail;
 $ mu query .logging
 logging {
   syslog yes;
   facility mail;
 };

Several command line options allow to modify output format. The --value option instructs the command to output only values:

 $ mu query --value .logging.syslog
 yes

The --path option instructs it to print full path names for each value:

 $ mu query --path .logging.syslog
 logging.syslog: yes

The --program option instructs mu to behave as if it was called under another program name. For example, the following command:

 $ mu query --program=pop3d .server.transcript

will return the value of the server.transcript statement for pop3d utility.

By default, mu query operates on the main configuration file. Another configuration file can be supplied using the --file (-f) option:

 $ mu query --file /usr/local/etc/file.conf .pidfile

2047

The mu 2047 command is a filter for decoding or encoding email message headers formatted in accordance with RFC 2047. By default, it operates in encode mode and assumes the _iso-8859-1_ encoding. If arguments are supplied in the command line, they are treated as the text to operate upon. Otherwise the command acts as a UNIX filter, reading lines from the standard input and printing results on the standard output:

For examle:

 $ mu 2047 'Keld Jørn Simonsen <keld@dkuug.dk>'
 =?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= <keld@dkuug.dk>

The decode mode can be requested via the --decode (-d) option:

 $ mu 2047 --decode '=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= <keld@dkuug.dk>'
 Keld Jørn Simonsen <keld@dkuug.dk>

The --charset (-c) option changes the default character set, e.g.:

 $ mu 2047 --charset=utf-8 'Keld Jørn Simonsen <keld@dkuug.dk>'
 =?utf-8?Q?Keld J=C3=B8rn Simonsen <keld@dkuug.dk>?=

This option is meaningful both in decode and in encode modes. In decode mode it instructs the utility to convert the output to the given character set. In encode mode it indicates the encoding of the input data, which will be reflected in the resulting string:

 $ quoted-printable 

The --encoding (-E) option can be used in encode mode to change the output encoding. Valid arguments for this option are: quoted-printable (the default) or base64.

The --newline (-n) option prints an additional newline character after each line of output.

filter

Applies a chain of filters to the input.

acl

Tests Mailutils access control lists;

wicket

Scans wickets for matching URLs

dbm

Invokes a DBM management tool.

logger

Logs information using Mailutils log facility.

pop

Invokes a POP3 client shell.

imap

Invokes an IMAP4 client shell (in development).