SENDMAIL(1) | Double Precision, Inc. | SENDMAIL(1) |
sendmail - Send an E-mail message
sendmail [option...] [--] [address...]
rmail [-f sender] {address} [address...]
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.
-f address
-F "name"
-N options
-n
-o, -t, -q
-R full
-R hdrs
-V "envid"
-S "level"
-bcc
-bs
-verp
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.
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[3] server has 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.
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.
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.
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)[4] manual page for more information.
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.
courier(8)[5], courieruucp(8)[4] mailq(8)[6], cancelmsg(1)[7], http://www.sendmail.org, http://www.qmail.org.
Sam Varshavchik
07/24/2017 | Courier Mail Server |