Scroll to navigation

SENDMAIL(1) Double Precision, Inc. SENDMAIL(1)

NAME

sendmail - Send an E-mail message

SYNOPSIS

sendmail [option...] [--] [address...]

rmail [-f sender] {address} [address...]

DESCRIPTION

The sendmail command reads an E-mail message and delivers the message to its recipients. This sendmail command is part of the Courier mail server, although it attempts to emulate the behavior of the original sendmail[1] MTA. Applications written for Sendmail should be able to use Courier mail server's sendmail. This sendmail wrapper understands most command line arguments used by sendmail 8.9. Certain sendmail-specific arguments that make no sense for Courier, (like -o), are silently ignored.

This sendmail always behaves like the real sendmail with the -oi and -t options. This is how most applications expect it to work. Some applications might run sendmail without the -oi and -t options, and expect sendmail's legacy behavior when those options are not used. Those application may have problems with this sendmail wrapper.

sendmail reads the message from standard input, rewrites its headers appropriately and delivers it to the specified recipients.

If at least one E-mail address is specified on the command line, sendmail delivers the message to those recipients only. If no addresses are specified on the command line, sendmail reads the message and builds the recipient list from the To:, Cc: and Bcc: headers.

sendmail always removes Bcc: headers before sending the message if recipients are not specified on the command line.

Some of the functionality described below is actually implemented by other Courier modules that sendmail runs automatically. This process is transparent to the end user, or the application.

OPTIONS

-f address

Sets the From: address. This is just the E-mail address only, not the name.

-F "name"

Sets the name to put in the From: header.

-N options

Sets delivery status notification options. options is a comma-separated list of one or more of the following keywords: never, success, fail, delay. If not specified, the -N option defaults to either "delay, fail", or just "fail", depending on systemwide options set by the administrator. The "success" keyword sends a return receipt to the sender when the message is succesfully received by each recipient. "fail" sends a notice if the message could not be delivered for some reason. "delay" sends a notice if the message remains undeliverable for a period of time (but has not yet completely failed). "never" means do not send any notices for any reason, but see BUGS below.

-n

Do not actually deliver the message, but copy it to standard output, after rewriting all the headers.

-o, -t, -q

These sendmail-specific options are ignored, because this is not the real sendmail.

-R full

Requests that delivery status notifications include the original message, in its entirety.

-R hdrs

Requests that delivery status notifications include just the headers of the original message.

-V "envid"

Specifies the original envelope id to be returned in delivery status notifications. Of interest only to mail robots.

-S "level"

Specify level as a minimum security level for delivering this message. This is a Courier-specific extension that uses a Courier-specific SMTP extension. level is either "NONE" or "STARTTLS". "NONE" specifies the normal security level (none at all); "STARTTLS" specifies that SSL/TLS must be used when transmitting this message to a remote mail relay, and the remote mail relay must supply a certificate that's signed by a private certificate authority that's configured in Courier. See Courier installation notes for more information.

-bcc

Read Bcc: headers only. Normally, if no recipients are specified, sendmail obtains the list of recipients by reading the To:, Cc: and Bcc: headers (Bcc: headers are then removed). The -bcc option ignores To: and Cc: headers for this purpose. This option is ignored if an explicit address list is specified on the sendmail command line.

-bs

Talk ESMTP on standard input. This option is actually implemented by running Courier's ESMTP server, which takes over and provides a complete ESMTP implementation.

-verp

Use a VERP for this message.

RETURN ADDRESS

The return address is the E-mail address where delivery status notifications (non-delivery notices, or return receipts) are sent for this message.

sendmail constructs the envelope sender (the return address), userid@host as follows, unless the -bs option was specified. If the -bs option is specified the envelope sender is specified via ESMTP commands, of course.

If the -f option was specified, the address specified by the -f option is used.

Otherwise, the userid portion of the return address is set to the contents of the first environment variable that's defined from the following list: MAILSUSER, MAILUSER, LOGNAME, LOGUSER. If none of these environment variables are defined, the system account name is used.

The host portion of the return address is set to the contents of the MAILSHOST environment variable. If MAILSHOST is not defined, MAILHOST will be used. If neither variable is set, the configured machine name is used.

The return address is then subject to the address rewriting rules for the "local" Courier module (the "esmtp" module when the -bs flag is specified).

Finally, if the -verp option was specified, the return address is VERPed.

Variable Envelope Return Paths (VERPs)

A VERP is a return address which contains the recipient address encoded in it. Not all MTAs support RFC 1894[2]-based delivery status notifications. VERPs permit mailing list software to identify non-deliverable addresses even in the absence of a machine-readable DSN.

This option exists mainly to support Courier's own mailing list manager. At this time, it's the only software in the world that knows how to use this option. The Qmail server originally had very similar functionality, for it's own mailing list manager. However, there are many functional differences between the two mail servers, so Courier mail server's and Qmail's mailing list managers are not interchangeable.

Except for this detail, Courier's implementation of a VERP is very similar to Qmail's. When a message from user@domain.com is addressed to address X, then return address will be set to user-Y@domain.com, where Y is defined as follows:

1. The last @ character in X is changed to the = character.

2. The remaining characters in X are copied verbatim to Y, except for some special characters like @, +, %, :, and !.

3. These special characters are replaced with the character +, followed by a two-character hexadecimal ASCII code for the special character.

Using -verp for a message to multiple recipients results in Courier generating and transmitting one copy of the message separately to every recipient. That's because the return address for every recipient is different, requiring a separate message to be sent.

Except in one case.

The one exception is when a VERPed message is sent from one Courier server to another Courier server via ESMTP. An ESMTP extension will be used to send one message, preserving the VERP status of the message. This ESMTP extension is described in the document, draft-varshavchik-verp-smtpext, a copy of which is included in Courier's source code.

SENDER ADDRESS

sendmail sets the contents of the From: header as follows. Note that this is not the same as the return address of the message.

If the -bs option is specified, none of the following will be applicable. All environment variables are ignored when the -bs option is used.

If the From: header is present in the message, but the environment variable MAILUSER is set, the userid portion of the From: header is replaced by the contents of MAILUSER.

If the From: header is present in the message, but the MAILHOST environment variable is set, the contents of MAILHOST replaces the host portion of the From: header.

If the From: header is present in the message, but either the -F option was specified, or the MAILNAME or the NAME environment variable is set, the contents of the -F option, or the environment variable, will replace the sender's name in the From: header.

If the From: header is not present in the message, one is constructed as follows. The sender's name is set by the -F option. If the -F option was not specified, the contents of the MAILNAME or the NAME environment variable is used. If neither variable is used, the name is looked up from the system account file. The userid portion of the address is set by the contents of any one of the following environment variables: MAILUSER, LOGNAME, USER. If none of these variables are set, the system userid is used. The host portion of the address is set by the contents of the MAILHOST environment variable. If it is not set, the system name of the server is used.

EXIT CODE

sendmail exits with exit status of zero if the message was succesfully scheduled for a delivery. If there was a problem accepting the message for delivery, sendmail displays an error message and exits with a non-zero status. The exit status will always be zero when the -bs option is used, unless a serious system problem occurs.

RMAIL

If called as rmail, only a subset of these options are available, namely -f, -verp, -N, -R, -V, -o, and -t. Other options are not allowed. Additionally, recipient addresses must be explicitly specified on the command line. The rmail alias is intended to be used for receiving mail via UUCP. You must install compatible UUCP software separately, and set it up so that it looks for rmail in Courier's installation directory.

When invoked as rmail this wrapper will refuse to run unless it is invoked by the uucp user. Additionally, the UU_MACHINE and UU_USER environment variables must be defined. Also, header and address rewriting described in previous paragraphs do not take place; instead, UUCP-specific header and address rewriting rules will apply. See the courieruucp(8)[3] manual page for more information.

BUGS

There are still some mail gateways out there that do not implement delivery status notifications according to RFC 1894. This means that you may get a delivery notice even if -N never keyword was specified.

Header rewriting rules are similar, but not identical, to Qmail's. The precedence of the various environment variables, plus the situations where they're used, are different from Qmail's and may produce different results.

SEE ALSO

courier(8)[4], courieruucp(8)[3] mailq(8)[5], cancelmsg(1)[6], http://www.sendmail.org.

AUTHOR

Sam Varshavchik

Author

NOTES

1.
sendmail
2.
RFC 1894
3.
courieruucp(8)
4.
courier(8)
5.
mailq(8)
6.
cancelmsg(1)
10/28/2020 Courier Mail Server