The M configuration command is composed of multiple parts. The format is:


Mname, {field=value}


where name is the name of the mailer (used internally only) and the "field=name" pairs define the attributes of the mailer.


Mailers can be found in the cf/mailer directory of the Sendmail tarball.


Mailers can include the following:


cyrus and cyrusbb - handle user+where syntax to a user's IMAP mailbox subfolder. Users do not have to have a local unix account


cyrusv2 - is version 2 of cyrus


discard, error, or none - causes the message to be accepted and then discarded or rejected. This is used in conjunction with the access database


fax - sends the message to a fax program such as hylafax. The fax program can be on the local host or a remote host machine


local - for local mail delivery


mail11 - for decnet users


phquery - The phquery program. Can be used to do CCSO name server lookups.


pop - delivery for pop (post office protocol) users - Users do not need to have a local unix account


procmail - an interface to procmail - procmail needs to be installed separately


prog - for delivery to a program


qpage - allows messages to be sent via an alphanumeric pager program such as quickpage


smtp, esmtp, smtp8, dsmtp, relay - for outbound mail


usenet - post messages to usenet via the inews program


uucp, uucp-old, uucp-new, uucp-dom, uucp-uudom - for uucp mail


The fields for a mailer are:


/ - The root directory for the mailer
Arg - An argument to pass to this mailer
Charset - The default character set for 8-bit characters
Directory - The working directory for the mailer
Eol - The end-of-line string for this mailer
Flags - Special flags for this mailer
Linelimit - The maximum line length in the message body
Maxsize - The maximum message length to this mailer
maxmessages - The maximum message deliveries per connection
Nice - The nice level for the mailer
Path - The path to and the name of the mailer
Queuegroup - The default queue group for the mailer
Recipient - Rewriting set(s) for recipient addresses
recipients - Maximum number of recipients per connection
Sender - Rewriting set(s) for sender addresses
Type - Type information for DSN diagnostics
Userid - The default user and group id to run as
Wait - The maximum time to wait for the mailer


Only the first character of the field name is checked (it's case-sensitive).


/= (forward slash equal) field specifies a new root directory for the mailer. The path is macro expanded and then passed to the "chroot" system call. The root directory is changed before the directory field is consulted or the uid is changed. It's up to you to make sure that the chroot directory has all the files that it needs to operate properly.


A= (uppercase a) list of command line arguments for the mail delivery program. The mail delivery program is defined by using P=/path/to/program. If P= a unix socket, [IPC], then A= the path and filename of the unix socket. $h means the host machine, $u means the recipient's name.


C= (uppercase c) default mime character set


D= (uppercase d) directory to use a working directory, $z is the user's home directory


E= (uppercase e) end of line string, defaults to \n, for smtp its \r\n


F= (uppercase f) delivery agent flag that tells Sendmail how the delivery agent will behave and what it needs. There's a whole list of these which will be discussed shortly.


L= (uppercase el) maximum line length, anything after that is wrapped to the next line, 0=unlimited


M= (uppercase m) maximum message size, both the header and body counts toward this


m= (lowercase m) maximum number of messages to send per connection


N= (uppercase n) nice level


P= (uppercase p) /path/to/mailer/program, P=[IPC] is a unix socket, P=[/path/to/file] appends the message to a file, P=[LPC] causes Sendmail to run in a sort of debugging mode


Q= (uppercase q) queuegroup to use


R= (uppercase r) ruleset to call for the recipient's envelope/header if both are listed, or for both the envelope and header if only one is listed.


r= (lowercase r) maximum number of recipients per envelope


S= (uppercase s) ruleset to call for the sender's envelope/header if both are listed, or for both the envelope and header if only one is listed.


U= (uppercase u) run as userid:groupid


Wait= specifies the maximum time to wait for the mailer to return after sending all the data to it. This applies to mailers that have been forked by Sendmail.


If a header rule in Sendmail is defined using H?P?, then IF the character between the question mark characters matches a character in the mailer's F= flag, then that header is added to the message, otherwise it is not added to the message.


The following flags may be used in the F= portion of the mailer definition.


% (percent) Do not attempt delivery on initial recipient of a message or on queue runs unless the queued message is selected using one of the -qI/-qR/-qS queue run modifiers or an ETRN request.


0 (zero) Don't look up the MX records for hosts sent via SMTP/LMTP. Do not apply FallbackMXhost either.


1 (one) Don't send null characters ('\0') to this mailer.


2 (two) Don't use ESMTP even if offered


3 (three) Extend the list of characters converted to =XX notation when converting to Quoted-Printable to include those that don't map cleanly between ASCII and EBCDIC. Useful if you have IBM mainframes on site.


5 (five) If no aliases are found for this address, pass the address through ruleset 5 for possible alternate resolution. This is intended to forward the mail to an alternate delivery spot.


6 (six) Strip headers to seven bits.


7 (seven) Strip all output to seven bits. This is the default if the L flag is set. Clearing this option is not sufficient to get full eight bit data passed through Sendmail. If the 7 option is set, this is essentially always set, since the eighth bit was stripped on input.


8 (eight) If set, it is acceptable to send eight bit data to this mailer; the usual attempt to do 8 to 7 bit MIME conversions will be bypassed.


9 (nine) If set, do limited 7 to 8 bit MIME conversions. These conversions are limited to text/plain data.


: (colon) Check addresses to see if they begin with ":include:"; if they do, convert them to the "*include*" mailer.


| (pipe) Check addresses to see if they begin with a '|'; if they do, send them to the "program" mailer.


/ (forward slash) Check addresses to see if they begin with a '/'; if they do, send them to the "*file*" mailer.


a (lowercase a) Run Extended SMTP (ESMTP) protocol. This flag defaults to on if the SMTP greeting message includes the word "ESMTP".


A (uppercase a) Look up the user part of the address in the alias database. Normally this is only set for local mailers.


b (lowercase b) Force a blank line at the end of a message.


B (uppercase b) Strip leading backslashes (\) off of the address; this is a subset of the functionality of the s flag.


c (lowercase c) Do not include comments in the addresses. This should only be used if you have to work around a remote mailer that gets confused by comments. This strips addresses of the form "Phrase <address>" or "address (Comment)" down to just "address".


C (uppercase c) If mail is received from a mailer with this flag set, any addresses in the header that do not have an at sign ("@") after being rewritten by ruleset three will have the "@domain" clause from the senders envelope address tacked on to it. This allows mail with headers of the form:


From: usera@hosta
To: userb@hostb, userc


to be rewritten as:


From: usera@hosta
To: userb@hostb, userc@hosta


automatically. However, it doesn't really work reliably.


d (lowercase d) Do not include angle brackets around route-address syntax addresses. This is useful on mailers that are going to pass addresses to a shell that might interpret angle brackets as I/O redirection. However, it does not protect against other shell metacharacters. Therefore, passing addresses to a shell should not be considered secure.


D (uppercase d) This mailer wants a "Date:" header line.


e (lowercase e) This mailer is expensive to connect to, so try to avoid connecting normally; any necessary connection will occur during a queue run.


E (uppercase e) Lines beginning with "From " in the message body will have a '>' sign appended to them. From becomes >From. This prevents the mail reader program from assuming that this is the start of another message as most readers interpret From as the start of a message.


f (lowercase f) The mailer wants a -f from flag, but only if this is a network forward operation (e.g., the mailer will give an error if the executing user does not have special permissions).


F (uppercase f) This mailer wants a "From:" header line.


g (lowercase g) Normally, Sendmail sends internally generated e-mail (e.g., error messages) using the null return address as required by RFC 1123. However, some mailers don't accept a null return address. If necessary, you can set the g flag to prevent Sendmail from obeying the standards; error messages will be sent as from the MAILER-DAEMON (actually, the value of the $n macro).


h (lowercase h) Upper case should be preserved in host names (the $@ portion of the mailer triplet resolved from ruleset 0 for this mailer.


I (uppercase i) This mailer will be speaking SMTP to another Sendmail - as such it can use special protocol features. This flag should not be used except for debugging purposes because it uses VERB as SMTP command.


k (lowercase k) Normally when Sendmail connects to a host via SMTP, it checks to make sure that this isn't accidentally the same host name, as might happen if Sendmail is misconfigured or if a long-haul network interface is set in loopback mode. This flag disables the loopback check. It should only be used under very unusual circumstances.


l (lowercase el) This mailer is local, final delivery will be performed.


m (lowercase m) This mailer can send to multiple users on the same host in one transaction. When a $u macro occurs in the argument part of the mailer definition, that field will be repeated as necessary for all qualifying users. Removing this flag can defeat duplicate suppression on a remote site as each recipient is sent in a separate transaction.


M (uppercase m) This mailer wants a "Message-Id:" header line.


n (lowercase n) Do not insert a UNIX-style "From" line on the front of the message.


o (lowercase oh) Always run as the owner of the recipient mailbox. Normally Sendmail runs as the sender for locally generated mail or as "daemon" (actually, the user specified in the u option) when delivering network mail. The normal behavior is required by most local mailers, which will not allow the envelope sender address to be set unless the mailer is running as a daemon. This flag is ignored if the S flag is set.


p (lowercase p) Use the route-addr style reverse-path in the SMTP "MAIL FROM:" command rather than just the return address; although this is required in RFC 821 section 3.1, many hosts do not process reverse-paths properly. Reverse-paths are officially discouraged by RFC 1123.


P (uppercase p) This mailer wants a "Return-Path:" line.


q (lowercase q) When an address that resolves to this mailer is verified (SMTP VRFY command), generate 250 responses instead of 252 responses. This will imply that the address is local.


r (lowercase r) Same as f, but sends a -r flag.


R (uppercase r) Open SMTP connections from a "secure" port. Secure ports aren't (secure, that is) except on UNIX machines, so it is unclear that this adds anything. Sendmail must be running as root to be able to use this flag.


s (lowercase s) Strip quote characters (" and \) off of the address before calling the mailer.


S (uppercase s) Don't reset the userid before calling the mailer. This would be used in a secure environment where Sendmail is run as root. This could be used to avoid forged addresses. If the U= field is also specified, this flag causes the effective user id to be set to that user.


u (lowercase u) Upper case should be preserved in user names for this mailer.


U (uppercase u) This mailer wants UUCP-style "From" lines with the ugly "remote from <host>" on the end.


w (lowercase w) The user must have a valid account on this machine, e.g., getpwnam must succeed. If not, the mail is bounced.


W (uppercase W) Ignore long term (Persistent) host status information.


x (lowercase x) This mailer wants a "Full-Name:" header line.


X (uppercase x) This mailer wants to use the hidden dot algorithm as specified in RFC 821; basically, any line beginning with a dot will have an extra dot prepended (to be stripped at the other end). This insures that lines in the message containing a dot will not terminate the message prematurely.


z (lowercase z) Run Local Mail Transfer Protocol (LMTP) between Sendmail and the local mailer. This is a variant on SMTP defined in RFC 2033 that is specifically designed for delivery to a local mailbox.


Z (uppercase z) Allows Sendmail to try to connect a second time if the first attempt fails. This is primarily used for dial up.


The mailer with the special name "error" can be used to generate a user error. The (optional) host field is an exit status to be returned, and the user field is a message to be printed. The exit status may be numeric or one of the values USAGE, NOUSER, NOHOST, UNAVAILABLE, SOFTWARE, TEMPFAIL, PROTOCOL, or CONFIG to return the corresponding EX_ exit code, or an enhanced error code as described in RFC 1893, Enhanced Mail System Status Codes. For example, the entry:


$#error $@ NOHOST $: Host unknown in this domain


on the RHS of a rule will cause the specified error to be generated and the "Host unknown" exit status to be returned if the LHS matches. This mailer is only functional in rulesets 0, 5, or one of the check_* rulesets. The host field can also contain the special token quarantine which instructs sendmail to quarantine the current message.


The mailer with the special name "discard" causes any mail sent to it to be discarded but otherwise treated as though it were successfully delivered. This mailer cannot be used in ruleset 0, only in the various address checking rulesets.


The mailer named "local" must be defined in every configuration file. This is used to deliver local mail, and is treated specially in several ways. Additionally, three other mailers named "prog", "*file*", and "*include*" may be defined to tune the delivery of messages to programs, files, and :include: lists respectively. They default to:


Mprog, P=/bin/sh, F=lsoDq9, T=DNS/RFC822/X-Unix, A=sh -c $u


M*file*, P=[FILE], F=lsDFMPEouq9, T=DNS/RFC822/X-Unix, A=FILE $u


M*include*, P=/dev/null, F=su, A=INCLUDE $u


Built-in pathnames are [FILE] and [IPC], the former is used for delivery to files, the latter for delivery via interprocess communication. For mailers that use [IPC] as pathname the argument vector (A=) must start with TCP or FILE for delivery via a TCP or a Unix domain socket. If TCP is used, the second argument must be the name of the host to contact.


Optionally a third argument can be used to specify a port, the default is smtp (port 25). If FILE is used, the second argument must be the name of the Unix domain socket.


If the argument vector does not contain $u then sendmail will speak SMTP (or LMTP if the mailer flag z is specified) to the mailer.


If no Eol field is defined, then the default is "\r\n" for SMTP mailers and "\n" of others.


The Sender and Recipient rewriting sets may either be a simple ruleset id or may be two ids separated by a slash; if so, the first rewriting set is applied to envelope addresses and the second is applied to headers. Setting any value to zero disables corresponding mailer-specific rewriting.


The Directory is actually a colon-separated path of directories to try. For example, the definition "D=$z:/" first tries to execute in the recipient's home directory; if that is not available, it tries to execute in the root of the filesystem. This is intended to be used only on the "prog" mailer, since some shells (such as csh) refuse to execute if they cannot read the current directory. Since the queue directory is not normally readable by unprivileged user's csh scripts as recipients can fail.


The Userid specifies the default user and group id to run as, overriding the DefaultUser option. If the S mailer flag is also specified, this user and group will be set as the effective uid and gid for the process. This may be given as user:group to set both the user and group id; either may be an integer or a symbolic name to be looked up in the passwd and group files respectively. If only a symbolic user name is specified, the group id in the passwd file for that user is used as the group id.


The Charset field is used when converting a message to MIME; this is the character set used in the Content-Type: header. If this is not set, the DefaultCharset option is used, and if that is not set, the value "unknown-8bit" is used. WARNING: this field applies to the sender's mailer, not the recipient's mailer. For example, if the envelope sender address lists an address on the local network and the recipient is on an external network, the character set will be set from the Charset= field for the local network mailer, not that of the external network mailer.


The Type= field sets the type information used in MIME error messages as defined by RFC 1894. It is actually three values separated by slashes: the MTA-type (that is, the description of how hosts are named), the address type (the description of e-mail addresses), and the diagnostic type (the description of error diagnostic codes). Each of these must be a registered value or begin with "X-". The default is "dns/rfc822/smtp".


The m= field specifies the maximum number of messages to attempt to deliver on a single SMTP or LMTP connection. The default is infinite.


The r= field specifies the maximum number of recipients to attempt to deliver in a single envelope. It defaults to 100.


The /= field specifies a new root directory for the mailer. The path is macro expanded and then passed to the "chroot" system call. The root directory is changed before the Directory field is consulted or the uid is changed.


The Wait= field specifies the maximum time to wait for the mailer to return after sending all data to it. This applies to mailers that have been forked by sendmail.


The Queuegroup= field specifies the default queue group in which received mail should be queued. This can be overridden.


There are one or more mail queues. Each mail queue belongs to a queue group. There is always a default queue group that is called mqueue (which is where messages go by default unless otherwise specified). The directory or directories which comprise the default queue group are specified by the QueueDirectory option. There are zero or more additional named queue groups declared using the Q command in the configuration file.


By default, a queued message is placed in the queue group associated with the first recipient in the recipient list. A recipient address is mapped to a queue group as follows. First, if there is a ruleset called queuegroup, and if this ruleset maps the address to a queue group name, then that queue group is chosen. That is, the argument for the ruleset is the recipient address and the result should be $# followed by the name of a queue group. Otherwise, if the mailer associated with the address specifies a queue group, then that queue group is chosen. Otherwise, the default queue group is chosen.


A message with multiple recipients will be split if different queue groups are chosen by the mapping of recipients to queue groups.


When a message is placed in a queue group, and the queue group has more than one queue, a queue is selected randomly.


If a message with multiple recipients is placed into a queue group with the 'r' option (maximum number of recipients per message) set to a positive value N, and if there are more than N recipients in the message, then the message will be split into multiple messages, each of which have at most N recipients.


Notice: if multiple queue groups are used, do not move queue files around, e.g., into a different queue directory. This may have weird effects and can cause mail not to be delivered.


Queue files and directories should be treated as opaque and should not be manipulated directly.


Next Section: Message Headers - 16 of 32



This Web Site Copyright © 1997 - 2008
by Alan Pae - All Rights Reserved