sendmail

Name

sendmail -- an electronic mail transport agent

Synopsis

sendmail [flags] [address ...]

Description

To deliver electronic mail (email), applications shall support the interface provided by /usr/sbin/sendmail (described here). This interface shall be the default delivery method for applications.

This program sends an email message to one or more recipients, routing the message as necessary. This program is not intended as a user interface routine.

With no flags, sendmail reads its standard input up to an end-of-file or a line consisting only of a single dot and sends a copy of the message found there to all of the addresses listed. It determines the network(s) to use based on the syntax and contents of the addresses.

It is recommended that applications use as few flags as necessary, none if possible.

Some agents allow aliasing on the local system to be prevented by preceding the address with a backslash.

The format of messages must be as defined in RFC 2822.

Options

-bm

reads mail from standard input and delivers to the recipient addresses. This is the default mode of operation.

-bp

lists information about messages currently in the input mail queue.

-bs

uses the SMTP protocol as described in RFC 2821; reads SMTP commands on standard input and writes SMTP responses on standard output.

Note that RFC 2821 specifies \r\n (CR-LF) be used at the end of each line, but UNIX pipes almost always use \n (LF) instead. To deal with this, agents will accept both \r\n and \n at the end of each line. When accepting \r\n, the \r before the \n is silently discarded.

-F fullname

explicitly sets the full name of the sender for incoming mail unless the message already contains a From: message header.

If the user running sendmail is not sufficiently trusted, then the actual sender may be indicated in the message, depending on the behavior of the agent.

-f name

explicitly sets the envelope sender address for incoming mail. If there is no From: header, the address specified in the From: header will also be set.

If the user running sendmail is not sufficiently trusted, then the actual sender will be indicated in the message.

-i

ignores dots alone on lines by themselves in incoming messages. This option is ignored when -bs is used.

-odb

delivers any mail in background, if supported; otherwise ignored.

-odf

delivers any mail in foreground, if supported; otherwise ignored.

-oem or -em

mails errors back to the sender. (default)

-oep or -ep

writes errors to the standard error output.

-oeq or -eq

does not send notification of errors to the sender. This only works for mail delivered locally.

-oi

is equivalent to -i.

-om

indicates that the sender of a message should receive a copy of the message if the sender appears in an alias expansion. Ignored if aliases are not supported.

-t

reads the message to obtain recipients from the To:, Cc:, and Bcc: headers in the message instead of from the command arguments. If a Bcc: header is present, it is removed from the message unless there is no To: or Cc: header, in which case a Bcc: header with no data is created, in accordance with RFC 2822.

If there are any arguments, they specify addresses to which the message is not to be delivered. That is, the argument addresses are removed from the recipients list obtained from the headers. Note: some agents implement this behavior in reverse, adding addresses instead of removing them. Others may disallow addresses in argument list. Therefore, applications should not put addresses in the argument list if -t is used.

This option is sometimes ignored when not in -bm mode (the default).

Exit status

0

successful completion on all addresses. This does not indicate successful delivery.

>0

there was an error.

LSB-deprecated Options

The behaviors specified in this section are expected to disappear from a future version of the LSB; applications should only use the non-LSB-deprecated behaviors.

The use of -i together with -bs is LSB-deprecated.

-oew or -ew

writes errors to the sender's terminal using the write(1) command, if he is logged in. Otherwise, mails errors back to the sender. If not supported, reports errors in the same manner as -oem.

-v

is more verbose. Additional -v options may make the software increasingly verbose.

Notes/Rationale

This page is believed to reflect functionality provided by smail, exim and other implementations, not just the sendmail implementation.