SENDMAIL(1)
๐ SENDMAIL(1) ๐
okay bestie, gather round, because this is the manual page for sendmail โ like, <emphasis>the</emphasis> sendmail, the classic mail-sending queen ๐ โ and this particular page was written by S. Varshavchik, so you know who to thank. ๐ซถ
She's serving <kbd>1</kbd> energy (that's a user command, section one of the manual, we love a main character), and we're gonna go through her section by section, fr fr.
โจ NAME โจ
sendmail โ Send an E-mail message ๐
That's the whole vibe check right there. You wanna send an e-mail? She's the one. Periodt.
โจ SYNOPSIS โจ
So there's two ways to call her, and they're not the same, okay? Two whole personalities:
๐ฆ the sendmail way
sendmail [option...] [--] [address...]
๐ฆ the rmail way
rmail [-f sender] {address} [address...]
ngl, look at rmail being all specific with the {address} โ curly braces meaning that one's not optional, bestie, she needs at least one address and then she's happy to take [address...] more after it. Meanwhile plain sendmail is flexible: options? sure. addresses? as many as you want, and zero is [address...] too so no pressure. โจ
Also quick heads up about that little -- sitting in there โ she's in the synopsis, she's real, and we'll get into what she does when we hit the options, so don't scroll away on me. ๐
no spoilers but there is so much more coming โ options, addresses, all of it. stay tuned, we're not done here ๐
๐ DESCRIPTION ๐
okay so the tea โ: sendmail reads an E-mail message and delivers it to its recipients. That's it, that's the job. But bestie, this particular sendmail is part of the Courier mail server, and it's out here doing its best impression of the original sendmail[1] MTA. Apps that were written for Sendmail should totally be able to use Courier's version without drama. This wrapper understands most of the command line arguments that sendmail 8.9 uses. And some of the very sendmail-specific args that just make zero sense for Courier (looking at you, -o) get silently ignored. no tantrum, no error, just vibes. ๐
This sendmail always behaves like the real sendmail with the -oi and -t options. That's how basically every application expects it to work, so we just do it. โญ But heads up: some applications might run sendmail without -oi and -t and expect sendmail's legacy behavior for when those options are absent. Those apps may have problems with this wrapper. ๐ซค iykyk.
So what actually happens under the hood? sendmail reads the message from standard input, rewrites its headers appropriately, and delivers it to the specified recipients. โจ
Here's the recipient logic, and it's giving very clean:
- If at least one E-mail address is specified on the command line,
sendmaildelivers the message to those recipients only. periodt. - If no addresses are specified on the command line,
sendmailreads the message and builds the recipient list from theTo:,Cc:andBcc:headers.
And here's a thing people constantly forget: sendmail always removes Bcc: headers before sending the message โ but only if recipients are not specified on the command line. So if you hand it addresses directly on the command line, that Bcc stripping logic isn't the one running here. ๐
Also, 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. You don't have to manage any of that. ๐ง
โจ OPTIONS โจ
-f addressโ Sets theFrom:address. ngl this is just the E-mail address only, not the name. ๐-F "name"โ Sets the name to put in theFrom:header. That's the human part, bestie.-N optionsโ Sets delivery status notification options.optionsis a comma-separated list of one or more of these keywords:never,success,fail,delay. If not specified,-Ndefaults to either"delay, fail", or just"fail", depending on systemwide options set by the administrator. Here's what each one means:successsends a return receipt to the sender when the message is succesfully received by each recipient โจ;failsends a notice if the message could not be delivered for some reason ๐ญ;delaysends a notice if the message remains undeliverable for a period of time (but has not yet completely failed) โณ;nevermeans 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. Great for peeking, not great for sending. ๐-o,-t,-qโ These sendmail-specific options are ignored, because this is not the real sendmail. sorry not sorry. ๐-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"โ Specifylevelas a minimum security level for delivering this message. This is a Courier-specific extension that uses a Courier-specific SMTP extension.levelis 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โ ReadBcc:headers only. Normally, if no recipients are specified,sendmailobtains the list of recipients by reading theTo:,Cc:andBcc:headers (Bcc:headers are then removed). The-bccoption ignoresTo:andCc:headers for this purpose. This option is ignored if an explicit address list is specified on thesendmailcommand 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. (More on that below, bestie, it's a whole thing.)
๐ฌ 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
-foption was specified, the address specified by the-foption is used. - Otherwise, the
useridportion 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
MAILSHOSTenvironment variable. IfMAILSHOSTis not defined,MAILHOSTwill 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).
And 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. it's giving clever, honestly. ๐
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. don't mix them, bestie. ๐
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:
- The last
@character in X is changed to the=character. - The remaining characters in X are copied verbatim to Y, except for some special characters like
@,+,%,:, and!. - 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. So yeah, that's a lot of messages. ๐ญ
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. two different things, bestie, keep them straight. โจ
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 variableMAILUSERis set, the userid portion of theFrom:header is replaced by the contents ofMAILUSER. - If the
From:header is present in the message, but theMAILHOSTenvironment variable is set, the contents ofMAILHOSTreplaces the host portion of theFrom:header. - If the
From:header is present in the message, but either the-Foption was specified, or theMAILNAMEor theNAMEenvironment variable is set, the contents of the-Foption, or the environment variable, will replace the sender's name in theFrom:header. - If the
From:header is present in the message, and contains two or more addresses, and either the-Foption was specified or one of the above environment variables were set, they get applied to every address in theFrom: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. ๐
๐ International domain names ๐
MAILHOST and MAILSHOST should be given in UTF-8. ACE-encoded hostnames get converted to UTF-8 for MAILSHOST. The replacement hostname portion of the From address is converted to ACE. ๐ค
MAILNAME and -F should be given in UTF-8, and is converted to RFC 2047[3]. โจ
๐ช 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)[4] manual page for more information. ๐ฆ
๐ BUGS (bestie, we gotta talk) ๐
Okay so there are still some mail gateways out there that do not implement delivery status notifications according to RFC 1894. ๐ญ Which means โ and I need you to hear me on this โ you may get a delivery notice even if -N never keyword was specified. Not a vibe. Not the gateway's fault exactly, but also. Lowkey their fault. ๐ซ
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. So if you're coming over from Qmail expecting the exact same behavior, bestie, it's giving surprise. ๐
๐ SEE ALSO (go read these too, i promise they slay) ๐
โจ AUTHOR โจ
Sam Varshavchik โ Author ๐
๐ NOTES ๐
sendmailโ http://www.sendmail.org/RFC 1894โ https://datatracker.ietf.org/doc/html/rfc1894RFC 2047โ https://datatracker.ietf.org/doc/html/rfc2047courieruucp(8)โ https://www.courier-mta.org/courieruucp.htmlcourier(8)โ https://www.courier-mta.org/courier.htmlmailq(8)โ https://www.courier-mta.org/mailq.htmlcancelmsg(1)โ https://www.courier-mta.org/cancelmsg.html
And that's the whole page, bestie, we made it to the end together ๐ซถ This one came from the Courier Mail Server, dated 03/15/2026, and it lives in section SENDMAIL(1). Go forth and send some mail, you absolute icon. -N never if you're being dramatic about the notifications. ๐
โจ๐
๐ฆ where this page comes from
- ubuntu stonking: courier-mta 2.0.6-1 ยท GPL-3+~with-OpenSSL-exception
- Copyright 1999 - 2026 S. Varshavchik. See COPYING for -->
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms