GNU Mailutils |
|
General-Purpose Mail Package |
Official GNU Software |
The principal object Mailutils operates on is mailbox – a collection of mail messages. The two main characteristics of a mailbox are its type and path. The type defines how the messages are stored within a mailbox. The path specifies the location of the mailbox. The two characteristics are usually combined within a Uniform Resource Locator (URL), which uniquely identifies the mailbox. The syntax for URL is:
type:[//[user:password@]host[:port]]path[?query][;params]
The square brackets do not appear in a URL, instead they are used to denote optional parts.
Not all parts are meaningful for all types. Their usage and purpose are described in the sections that follow.
Local mailboxes store mail in files on the local file system. A local mailbox URL is:
type://path[;params]
The path defines its location in the file system. For example:
mbox:///var/spool/mail/gray
Optional params is a semicolon-separated list of optional arguments that configures indexed directory structure. See local URL parameters, for a detailed description.
The local mailbox types are:
A traditional UNIX mailbox format. Messages are stored sequentially in a single file. Each message begins with a ‘From’ line, identifying its sender and date when it was received. A single empty line separates two adjacent messages.
This is the default format.
The Maildir mailbox format. Each message is kept in a separate file with a unique name. Each mailbox is therefore a directory. This mailbox format eliminates file locking and makes message access much faster.
This format was originally described by D. J. Bernstein in http://cr.yp.to/proto/maildir.html.
MH Message Handling System format. Each message is kept in a separate file named after its sequential numeric identifier within the mailbox. Deleted messages are not removed, but instead the corresponding file is renamed by prepending a comma to its original name. Each mailbox is a directory. Mailboxes can be nested.
This format was originally developed by RAND Corporation. Mailutils implementation is compatible both with the original implementation and with its descendant nmh.
This type can be used when accessing an existing mailbox of any of the formats defined above. The actual mailbox format is determined automatically. This type is assumed when a mailbox is referred to by its full pathname.
Remote mailboxes are accessed via one of the remote message protocols.
The basic remote mailbox types are:
Remote mailbox accessed using the Post Office Protocol (POP3). Default port number 110.
The URL is:
pop://[user[:pass][;auth=+APOP]@]host[:port][;notls]
The host gives the name or IP address of the host running a POP3 server. Optional port can be used to connect to a port other than the default 110.
The user and pass supply authentication credentials. If any of them is missing, Mailtils will first try to obtain it from the ticket file. If that fails, the behavior depends on the type of the controlling terminal. If the terminal is a tty device (i.e. the program accessing the mailbox was started from the command line), it will ask the user to supply the missing credentials. Otherwise it will issue an appropriate error message and refuse to access the mailbox.
By default, the usual POP3 authentication is used. The ‘auth=+APOP’ authentication parameter instructs Mailutils to use APOP authentication instead.
If the server offers the STLS capability, Mailutils will attempt to establish encrypted TLS connection. The ‘notls’ parameter disables this behavior.
Remote mailbox accessed using the Post Office Protocol (POP3). The transmission channel is encrypted using the transport layer security (TLS). The default port is 995.
The URL is:
pops://[user[:pass][;auth=+APOP]@]host[:port]
The meaning of its components is the same as for ‘pop’ type.
Remote mailbox accessed via the Internet Message Access Protocol. Default port number is 143.
The URL is:
imap://[user[:pass]@]host[:port][;notls]
The host gives the name or IP address of the host running a IMAP4 server. Optional port can be used to connect to a port other than the default 143.
The user and pass supply authentication credentials. If any of them is missing, Mailtils will first try to obtain it from the ticket file. If that fails, the behavior depends on the type of the controlling terminal. If the terminal is a tty device (i.e. the program accessing the mailbox was started from the command line), it will ask the user to supply the missing credentials. Otherwise it will issue an appropriate error message and refuse to access the mailbox.
If the server offers the STARTTLS capability, Mailutils will attempt to establish encrypted TLS connection. The ‘notls’ parameter disables this behavior.
The ‘imaps’ type differs in that its transmission channel is encrypted using the transport layer security (TLS). The default port is 993.
The URL is:
imaps://[user[:pass]@]host[:port]
The meaning of its components is the same as for ‘imap’ type.
SMTP mailboxes types are special remote mailboxes that allow only append operation. Appending a message is equivalent to sending it to the given recipient or recipients.
A remote mailbox accessed using the Simple Message Transfer Protocol.
The SMTP URL syntax is:
smtp://[user[:pass][;auth=mech,...]@]host[:port][;params]
The host gives the name or IP address of the host running SMTP server. Optional port can be used to connect to a port other than the default 25.
The user, pass, and ‘auth=’ elements supply credentials for ESMTP authentication, if the server supports it.
If the ESMTP authentication is used, Mailutils will select the best authentication mechanism from the list offered by the server. To force it to use a particular authentication mechanism, use the ‘auth’ authentication parameter. Its value is a comma-separated list of authentication mechanisms, in the order from the most to the least preferred one, e.g.:
smtp://smith:guessme;auth=cram-md5,digest-md5@localhost
Optional params is a semicolon-separated list of additional parameters. Valid parameters are:
Append ‘@string’ to those recipient addresses that lack the domain part.
Use addr as sender address.
Disable ESMTP authentication.
Disable TLS.
Use the supplied header names to determine recipient addresses. When no values are supplied, disables header scanning.
Strip domain part from all recipient addresses.
Deliver messages to the supplied email addresses.
A remote mailbox accessed using the Simple Message Transfer Protocol, with the transmission channel encrypted using the transport layer security (TLS). The default port is 465.
The URL is
smtps://[user[:pass][;auth=mech,...]@]host[:port][;params]
See the ‘smtp’ type for a detailed description of its types. The only difference from ‘smtp’ is that the ‘notls’ parameter is not used.
Program mailboxes support only append operation. Appending a message is performed by invoking the specified program and passing the message to its standard input stream.
A ‘sendmail’ mailbox is identified by the following URL:
sendmail[://path]
The messages are sent by invoking sendmail
binary with the
-oi -t options. If the message being appended has the
‘From:’ header, its value is passed to sendmail
using
the -f option.
The default path to the sendmail binary is system-dependent. The path part can be used to specify it explicitly.
The ‘prog’ mailbox URL is:
prog://pathname[?query]
Messages are appended by invoking the program pathname with the arguments supplied by query. The latter is a list of words delimited by ‘&’ characters.
Arguments can contain the following variables (see Variables):
Expands to the sender email address.
Expands to comma-separated list of email addresses obtained from ‘To:’, ‘Cc:’ and ‘Bcc:’ headers of the message.
This document was generated on January 2, 2022 using makeinfo.
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.