SENDMAIL(1)
๐ SENDMAIL ๐ (1)
okay bestie, pull up a chair, because this is <rainbow>sendmail</rainbow> from the General Commands Manual, section <cyan>1</cyan>, a.k.a. the Postfix to Sendmail compatibility interface. she's giving legacy-but-make-it-serve. ๐ซถ
โจ NAME โจ
sendmail โ Postfix to Sendmail compatibility interface
๐ฆ SYNOPSIS ๐ฆ
sendmail [option ...] [recipient ...]
mailq
sendmail -bp
newaliases
sendmail -I
๐ธ DESCRIPTION ๐ธ
so the Postfix sendmail(1) command is the Postfix to Sendmail compatibility interface. the whole point, the moment, the vibe. ๐
and for the sake of compatibility with existing applications (the old ones, the ones that refuse to change), some Sendmail command-line options are recognized but silently ignored. not me getting away with that. ๐
by default, Postfix sendmail(1) reads a message from standard input until EOF or until it reads a line with only a . character, and arranges for delivery. Postfix sendmail(1) relies on the postdrop(1) command to create a queue file in the maildrop directory. teamwork makes the dream work, fr fr. โจ
specific command aliases are provided for other common modes of operation, and honestly? iconic little shortcuts:
mailqโ list the mail queue. ๐ each entry shows the queue file ID, message size, arrival time, sender, and the recipients that still need to be delivered. if mail could not be delivered upon the last attempt, the reason for failure is shown. the queue ID string is followed by an optional status character:*โ the message is in the active queue, i.e. the message is selected for delivery. it's giving chosen. ๐!โ the message is in the hold queue, i.e. no further delivery attempt will be made until the mail is taken off hold. she's on pause, respectfully. ๐ซถ#โ the message is forced to expire. see thepostsuper(1)options-eor-f. rip bestie ๐ญ- this mode of operation is implemented by executing the
postqueue(1)command.
newaliasesโ initialize the alias database. ๐ if no input file is specified (with the-oAoption, see below), the program processes the file(s) specified with thealias_databaseconfiguration parameter. if no alias database type is specified, the program uses the type specified with thedefault_database_typeconfiguration parameter. this mode of operation is implemented by running thepostalias(1)command.
note: it may take a minute or so before an alias database update becomes visible. use the "postfix reload" command to eliminate this delay. (yes queen, refresh the page. ๐)
these and other features can be selected by specifying the appropriate combination of command-line options. some features are controlled by parameters in the main.cf configuration file. mix and match, it's your world. ๐
๐ง the options, bestie (recognized) ๐ง
the following options are recognized:
-Am(ignored) โ literally nothing. a ghost. a rumor. ๐ป-Ac(ignored) โ Postfixsendmailuses the same configuration file regardless of whether or not a message is an initial submission. one config to rule them all.-B body_typeโ the message body MIME type:7BITor8BITMIME.-bdโ go into daemon mode. ๐ง this mode of operation is implemented by executing the"postfix start"command.-bh(ignored) โ nope, nothing here either.-bH(ignored) โ Postfix has no persistent host status database. that's just not a thing she does. ๐-biโ initialize alias database. see thenewaliasescommand above.-blโ go into daemon mode. to accept only local connections as with Sendmail's-bloption, specify"inet_interfaces = loopback"in the Postfixmain.cfconfiguration file. local only, no strangers. โจ-bmโ read mail from standard input and arrange for delivery. this is the default mode of operation. the main character, basically. ๐-bpโ list the mail queue. see themailqcommand above.-bsโ stand-alone SMTP server mode. ๐ read SMTP commands from standard input, and write responses to standard output. in stand-alone SMTP server mode, mail relaying and other access controls are disabled by default. to enable them, run the process as themail_owneruser.
this mode of operation is implemented by running the smtpd(8) daemon.
-bvโ do not collect or deliver a message. instead, send an email report after verifying each recipient address. this is useful for testing address rewriting and routing configurations. ๐งช๐
this feature is available in Postfix version 2.1 and later.
-C config_file/-C config_dirโ the path name of the Postfixmain.cffile, or of its parent directory. this information is ignored with Postfix versions before2.3.
with Postfix version 3.2 and later, a non-default directory must be authorized in the default main.cf file, through the alternate_config_directories or multi_instance_directories parameters.
with all Postfix versions, you can specify a directory pathname with the MAIL_CONFIG environment variable to override the location of configuration files. ๐ซถ
-F full_nameโ set the sender full name. this overrides theNAMEenvironment variable, and is used only with messages that have noFrom:message header.-f senderโ set the envelope sender address. this is the address where delivery problems are sent to. with Postfix versions before2.1, theErrors-To:message header overrides the error return address. ๐ฌ-Gโ gateway (relay) submission, as opposed to initial user submission. either do not rewrite addresses at all, or update incomplete addresses with the domain information specified withremote_header_rewrite_domain. ๐ช
this option is ignored before Postfix version 2.3.
-h hop_count(ignored) โ hop count limit. use thehopcount_limitconfiguration parameter instead.-Iโ initialize alias database. see thenewaliasescommand above.-iโ when reading a message from standard input, don't treat a line with only a.character as the end of input. keep going, keep going. ๐-L label(ignored) โ the logging label. use thesyslog_nameconfiguration parameter instead.-m(ignored) โ backwards compatibility. that's it, that's the tweet.-N dsn(default:'delay, failure') โ delivery status notification control. specify either a comma-separated list with one or more of:failureโ send notification when delivery failsdelayโ send notification when delivery is delayedsuccessโ send notification when the message is delivered
โฆor specify never (don't send any notifications at all). your inbox, your rules. ๐
this feature is available in Postfix 2.3 and later.
-n(ignored) โ backwards compatibility. bestie, she's just here for the heritage. ๐-O requiretls=yes/-O requiretls=noโ when delivering a message to an SMTP or LMTP server, the connection must use TLS with a verified server certificate, and that server must supportREQUIRETLS. the"requiretls"name and option value are case-insensitive.REQUIRETLSenforcement is controlled with the configuration parametersrequiretls_enable,smtp_requiretls_policy, andlmtp_requiretls_policy. ๐โจ
this feature is available in Postfix 3.11 and later.
-O smtputf8=yes/-O smtputf8=noโ when delivering a message to an SMTP or LMTP server, and an envelope address or message header contains UTF8 text, that server must supportSMTPUTF8. the"smtputf8"option name and value are case-insensitive. ๐
this feature is available in Postfix 3.11 and later.
-O option=value(ignored) โ set the named option tovalue. use the equivalent configuration parameter inmain.cfinstead.-oAalias_databaseโ non-default alias database. specifypathnameortype:pathname. seepostalias(1)for details.-o7(ignored) /-o8(ignored) โ to send 8-bit or binary content, use an appropriate MIME encapsulation and specify the appropriate-Bcommand-line option. ๐-oiโ when reading a message from standard input, don't treat a line with only a.character as the end of input.-om(ignored) โ the sender is never eliminated from alias etc. expansions.-o x value(ignored) โ set optionxtovalue. use the equivalent configuration parameter inmain.cfinstead.-r senderโ set the envelope sender address. this is the address where delivery problems are sent to. with Postfix versions before2.1, theErrors-To:message header overrides the error return address.-R returnโ delivery status notification control. specify"hdrs"to return only the header when a message bounces,"full"to return a full copy (the default behavior). ๐
the -R option specifies an upper bound; Postfix will return only the header, when a full copy would exceed the bounce_size_limit setting.
this option is ignored before Postfix version 2.10.
-qโ attempt to deliver all queued mail. this is implemented by executing thepostqueue(1)command.
โ ๏ธ warning: flushing undeliverable mail frequently will result in poor delivery performance of all other mail. do not spam the flush bestie, it's not the move. ๐ญ
-qinterval(ignored) โ the interval between queue runs. use thequeue_run_delayconfiguration parameter instead.-qIqueueidโ schedule immediate delivery of mail with the specified queue ID. this option is implemented by executing thepostqueue(1)command, and is available with Postfix version2.4and later. โก-qRsiteโ schedule immediate delivery of all mail that is queued for the named site. this option accepts only site names that are eligible for the"fast flush"service, and is implemented by executing thepostqueue(1)command. seeflush(8)for more information about the"fast flush"service.-qSsiteโ this command is not implemented. use the slower"sendmail -q"command instead. ๐ข-tโ extract recipients from message headers. these are added to any recipients specified on the command line.
with Postfix versions prior to 2.1, this option requires that no recipient addresses are specified on the command line.
-U(ignored) โ initial user submission.-V envidโ specify the envelope ID for notification by servers that supportDSN. ๐
this feature is available in Postfix 2.3 and later.
-XV(Postfix2.2and earlier:-V) โ Variable Envelope Return Path. given an envelope sender address of the formowner-listname@origin, each recipientuser@domainreceives mail with a personalized envelope sender address. โจ
by default, the personalized envelope sender address is owner-listname+user=domain@origin. the default + and = characters are configurable with the default_verp_delimiters configuration parameter.
-XVxy(Postfix 2.2 and earlier:-Vxy) โ it's literally-XVbut you get to pick x and y as your VERP delimiter characters yourself, instead of just going with whatever thedefault_verp_delimitersconfiguration parameter says. custom delimiters, your rules ๐-vโ sends an email report of the first delivery attempt (this is a Postfix 2.1 and later thing). Mail delivery itself always happens in the background, no exceptions. But bestie, listen: when you stack multiple-voptions, it turns on verbose logging for debugging purposes. one-v= a lil report, many-v= full on detective mode ๐-Xlog_file โ (ignored). Like, genuinely ignored, it does nothing now. It used to log mailer traffic. Now you use thedebug_peer_listanddebug_peer_levelconfiguration parameters instead. rip to a real one ๐ชฆ
๐ SECURITY ๐
By design, this program is not set-user (or group) id. It's built to handle message content from untrusted users, and possibly remote ones too. so like, it's not walking around with extra powers, ok? ๐ซถ
BUT โ and this is the big BUT โ like most Postfix programs, it does not enforce a security policy on its command-line arguments. Instead it's relying on the UNIX system to enforce access policies based on the effective user and group IDs of the process. Concretely, this means running Postfix commands as root (from sudo or equivalent) on behalf of a non-root user is likely to create privilege escalation opportunities. not cute. not the vibe. ๐ญ
If an application runs any Postfix programs on behalf of users that don't have normal shell access to Postfix commands, then that application MUST restrict user-specified command-line arguments to avoid privilege escalation. MUST. all caps. I don't make the rules (Wietse does) ๐
- Filter all command-line arguments, for example arguments that contain a pathname or that specify a database access method. These pathname checks must reject user-controlled symlinks or hardlinks to sensitive files, and must not be vulnerable to TOCTOU race attacks. yes, TOCTOU, look it up, it's giving sneaky ๐
- Disable command options processing for all command arguments that contain user-specified data. For example, the Postfix
sendmail(1)command line MUST be structured as follows:
/path/to/sendmail system-arguments -- user-arguments
Here, the -- disables command option processing for all user-arguments that follow.
Without the --, a malicious user could enable Postfix sendmail(1) command options, by specifying an email address that starts with -. yeah. one lil dash. that's all it takes. protect the -- with your life ๐
๐ฉบ DIAGNOSTICS ๐ฉบ
Problems get logged to syslogd(8) or postlogd(8), and to the standard error stream. so if something's wrong, it will tell you, multiple places actually ๐ธ
๐ฑ ENVIRONMENT ๐ฑ
MAIL_CONFIGโ directory with Postfix configuration files.MAIL_VERBOSE(value does not matter) โ enable verbose logging for debugging purposes. literally any value, it just needs to exist.MAIL_DEBUG(value does not matter) โ enable debugging with an external command, as specified with thedebugger_commandconfiguration parameter.NAMEโ the sender full name. This is used only with messages that have noFrom:message header. See also the-Foption above. yes, the same-F. go look, it's up there ๐
โ๏ธ CONFIGURATION PARAMETERS โ๏ธ
The following main.cf parameters are especially relevant to this program. The text below provides only a parameter summary. See postconf(5) for more details including examples. so like, this is the trailer, not the whole movie ๐ฌ
๐งฉ COMPATIBILITY CONTROLS ๐งฉ
Available with Postfix 2.9 and later:
sendmail_fix_line_endings(always) โ controls how the Postfixsendmailcommand converts email message line endings from<CR><LF>into UNIX format (<LF>). Windows line endings, we're fixing you ๐ ๏ธ
๐ง TROUBLE SHOOTING CONTROLS ๐ง
The DEBUG_README file gives examples of how to troubleshoot a Postfix system. read it, it's giving helpful ๐
debugger_command(empty) โ the external command to execute when a Postfix daemon program is invoked with the-Doption.debug_peer_level(2) โ the increment in verbose logging level when a nexthop destination, remote client or server name or network address matches a pattern given with thedebug_peer_listparameter.debug_peer_list(empty) โ optional list of nexthop destination, remote client or server name or network address patterns that, if matched, cause the verbose logging level to increase by the amount specified in$debug_peer_level.
๐ช ACCESS CONTROLS ๐ช
Available in Postfix version 2.2 and later:
authorized_flush_users(static:anyone) โ list of users who are authorized to flush the queue.authorized_mailq_users(static:anyone) โ list of users who are authorized to view the queue.authorized_submit_users(static:anyone) โ list of users who are authorized to submit mail with thesendmail(1)command (and with the privilegedpostdrop(1)helper command). note: privileged helper. respect it ๐ค
๐ RESOURCE AND RATE CONTROLS ๐
bounce_size_limit(50000) โ the maximal amount of original message text that is sent in a non-delivery notification.fork_attempts(5) โ the maximal number of attempts tofork()a child process.fork_delay(1s) โ the delay between attempts tofork()a child process.hopcount_limit(50) โ the maximal number ofReceived:message headers that is allowed in the primary message headers.queue_run_delay(300s) โ the time between deferred queue scans by the queue manager; prior to Postfix 2.4 the default value was1000s. glow up moment fr ๐
โก FAST FLUSH CONTROLS โก
The ETRN_README file describes configuration and operation details for the Postfix "fast flush" service.
fast_flush_domains($relay_domains) โ optional list of destinations that are eligible for per-destination logfiles with mail that is queued to those destinations.
๐ VERP CONTROLS ๐
The VERP_README file describes configuration and operation details of Postfix support for variable envelope return path addresses. variable envelope return path, say it with your chest ๐ฃ๏ธ
default_verp_delimiters(+=) โ the two default VERP delimiter characters.verp_delimiter_filter(-=+) โ the characters Postfix accepts as VERP delimiter characters on the Postfixsendmail(1)command line and in SMTP commands.
๐ MISCELLANEOUS CONTROLS ๐
alias_database(seepostconf -doutput) โ the alias databases forlocal(8)delivery that are updated withnewaliasesor withsendmail -bi.command_directory(seepostconf -doutput) โ the location of all postfix administrative commands.config_directory(seepostconf -doutput) โ the default location of the Postfixmain.cfandmaster.cfconfiguration files.daemon_directory(seepostconf -doutput) โ the directory with Postfix support programs and daemon programs.default_database_type(seepostconf -doutput) โ the default database type for use innewaliases(1),postalias(1)andpostmap(1)commands.delay_warning_time(0h) โ the time after which the sender receives a copy of the message headers of mail that is still queued.import_environment(seepostconf -doutput) โ the list of environment variables that a privileged Postfix process will import from a non-Postfix parent process, or name=value environment overrides.mail_owner(postfix) โ the UNIX system account that owns the Postfix queue and most Postfix daemon processes.queue_directory(seepostconf -doutput) โ the location of the Postfix top-level queue directory.remote_header_rewrite_domain(empty) โ rewrite or add message headers in mail from remote clients if theremote_header_rewrite_domainparameter value is non-empty, updating incomplete addresses with the domain specified in theremote_header_rewrite_domainparameter, and adding missing headers.syslog_facility(mail) โ the syslog facility of Postfix logging.syslog_name(seepostconf -doutput) โ a prefix that is prepended to the process name in syslog records, so that, for example,smtpdbecomesprefix/smtpd.
Postfix 3.2 and later:
alternate_config_directories(empty) โ a list of non-default Postfix configuration directories that may be specified with-cconfig_directory on the command line (in the case ofsendmail(1), with the-Coption), or via theMAIL_CONFIGenvironment parameter.multi_instance_directories(empty) โ an optional list of non-default Postfix configuration directories; these directories belong to additional Postfix instances that share the Postfix executable files and documentation with the default Postfix instance, and that are started, stopped, etc., together with the default Postfix instance. multiple instances, one icon era ๐
Postfix 3.11 and later:
requiretls_enable(yes) โ enable support for the ESMTP verbREQUIRETLSin theMAIL FROMcommand.
๐ FILES ๐
/var/spool/postfix, mail queue/etc/postfix, configuration files
๐ SEE ALSO ๐
pickup(8), mail pickup daemonqmgr(8), queue managersmtpd(8), SMTP serverflush(8), fast flush servicepostsuper(1), queue maintenancepostalias(1), create/update/query alias databasepostdrop(1), mail posting utilitypostfix(1), mail system controlpostqueue(1), mail queue controlpostlogd(8), Postfix loggingsyslogd(8), system logging
๐ README_FILES ๐
Use postconf readme_directory or postconf html_directory to locate this information.
DEBUG_README, Postfix debugging howtoETRN_README, Postfix ETRN howtoVERP_README, Postfix VERP howto
๐ LICENSE ๐
The Secure Mailer license must be distributed with this software. non-negotiable bestie โจ
๐ AUTHOR(S) ๐
Wietse Venema IBM T.J. Watson Research P.O. Box 704 Yorktown Heights, NY 10598, USA
Wietse Venema Google, Inc. 111 8th Avenue New York, NY 10011, USA
and that's a wrap on the SENDMAIL(1) page, bestie ๐ that lil SENDMAIL(1) footer sitting at the bottom of the page is the source-and-version stamp, so if you ever forget which manpage you're living in, just scroll down and let it remind you. go configure something iconic ๐
โจ
๐ฆ where this page comes from
- alpine 3.24: postfix-doc 3.11.7-r0 ยท IPL-1.0 EPL-2.0
- arch rolling: postfix 3.11.7-1 ยท EPL-2.0 OR IPL-1.0 AND BSD-4-Clause-UC
- nixos 26.05: postfix 3.11.7
- nixpkgs unstable: postfix 3.11.7
- ubuntu stonking: postfix 3.11.7-1ubuntu2
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms