sendmail - Postfix to Sendmail compatibility interface
| Use Case | Command | Description |
|---|---|---|
| 📧 Send mail | sendmail [options] [recipient...] |
Reads message from stdin, delivers to recipients |
| 📋 List mail queue | mailq or sendmail -bp |
Shows queued messages with status |
| 🔄 Initialize alias database | newaliases or sendmail -I |
Rebuilds alias database |
| ⚙️ Daemon mode | sendmail -bd |
Starts Postfix as a daemon (equivalent to postfix start) |
| 🔍 Verify recipients | sendmail -bv [recipient...] |
Tests address rewriting and routing (no delivery) |
| 🚀 Flush queue | sendmail -q |
Attempts immediate delivery of all queued mail |
| 📬 Standalone SMTP server | sendmail -bs |
Reads SMTP commands from stdin, writes responses to stdout |
| 🔗 VERP support | sendmail -XV |
Variable Envelope Return Path for personalized bounces |
sendmail [option ...] [recipient ...]
mailq
sendmail -bp
newaliases
sendmail -I
The Postfix sendmail(1) command implements the Postfix to Sendmail compatibility interface. For the sake of compatibility with existing applications, some Sendmail command-line options are recognized but silently ignored.
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.
Specific command aliases are provided for other common modes of operation:
* – The message is in the active queue (selected for delivery).! – The message is in the hold queue (no further delivery attempt until taken off hold).# – The message is forced to expire. See postsuper(1) options -e or -f.alias_database configuration parameter. If no alias database type is specified, uses the type specified with default_database_type. This mode is implemented by running the postalias(1) command.
postfix reload to eliminate this delay.
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.
The following options are recognized:
-Am (ignored)-Ac (ignored) – Postfix sendmail uses the same configuration file regardless of whether a message is an initial submission.-B body_type – 📧 Message body MIME type: 7BIT or 8BITMIME.-bd – 🖥️ Go into daemon mode. Implemented by executing postfix start.-bh (ignored)-bH (ignored) – Postfix has no persistent host status database.-bi – Initialize alias database. See newaliases above.-bl – 🖥️ Go into daemon mode. To accept only local connections as with Sendmail's -bl, specify inet_interfaces = loopback in main.cf.-bm – 📧 Read mail from stdin and deliver. Default mode.-bp – 📋 List the mail queue. See mailq above.-bs – 🌐 Stand-alone SMTP server mode. Reads SMTP commands from stdin, writes responses to stdout. Mail relaying and access controls are disabled by default; enable them by running as mail_owner user. Implemented by running smtpd(8).-bv – 🔍 Do not collect or deliver a message. Instead, send an email report after verifying each recipient address. Useful for testing address rewriting and routing. (Postfix 2.1+)-C config_file or -C config_dir – 📁 Path name of Postfix main.cf or its parent directory. Ignored before Postfix 2.3. With Postfix 3.2+, non-default directory must be authorized via alternate_config_directories or multi_instance_directories. Alternatively, set MAIL_CONFIG environment variable.-F full_name – 👤 Set the sender full name. Overrides NAME environment variable, used only for messages without From: header.-f sender – 📧 Set the envelope sender address (where delivery problems are sent). With Postfix before 2.1, Errors-To: header overrides error return address.-G – 🔄 Gateway (relay) submission, as opposed to initial user submission. Either does not rewrite addresses, or updates incomplete addresses with remote_header_rewrite_domain. Ignored before Postfix 2.3.-h hop_count (ignored) – Hop count limit. Use hopcount_limit configuration parameter instead.-I – Initialize alias database. See newaliases above.-i – 🚫 When reading from stdin, don't treat a line with only a . as end of input.-L label (ignored) – Logging label. Use syslog_name instead.-m (ignored) – Backwards compatibility.-N dsn (default: delay, failure) – 📬 Delivery status notification control. Specify comma-separated list: failure, delay, success; or never. (Postfix 2.3+)-n (ignored) – Backwards compatibility.-oAalias_database – 📁 Non-default alias database. Specify pathname or type:pathname. See postalias(1).-O option=value (ignored) – Set option. Use equivalent main.cf parameter instead.-o7 (ignored)-o8 (ignored) – To send 8-bit or binary content, use appropriate MIME encapsulation and -B option.-oi – 🚫 Same as -i: don't treat lone . as end of input.-om (ignored) – Sender is never eliminated from alias expansions.-o x value (ignored) – Set option x to value. Use equivalent main.cf parameter.-r sender – 📧 Same as -f: set envelope sender address.-R return – 📬 Delivery status notification control. Specify hdrs (return only header) or full (full copy, default). -R sets an upper bound; Postfix returns only header if full copy would exceed bounce_size_limit. (Postfix 2.10+)-q – 🚀 Attempt to deliver all queued mail. Implemented by executing postqueue(1). Warning: flushing undeliverable mail frequently hurts performance.-qinterval (ignored) – Queue run interval. Use queue_run_delay.-qIqueueid – 🚀 Schedule immediate delivery of mail with specified queue ID. Implemented by postqueue(1). (Postfix 2.4+)-qRsite – 🚀 Schedule immediate delivery of all mail queued for the named site. Only site names eligible for "fast flush" service. Implemented by postqueue(1). See flush(8).-qSsite – 🚫 Not implemented. Use slower sendmail -q instead.-t – 📧 Extract recipients from message headers (added to command-line recipients). With Postfix before 2.1, no recipients allowed on command line.-U (ignored) – Initial user submission.-V envid – 📬 Specify envelope ID for DSN notification. (Postfix 2.3+)-XV (Postfix 2.2 and earlier: -V) – 📬 Variable Envelope Return Path. For envelope sender owner-listname@origin, each recipient user@domain gets personalized envelope sender owner-listname+user=domain@origin. Default delimiters += configurable with default_verp_delimiters.-XVxy (Postfix 2.2 and earlier: -Vxy) – As -XV, but uses x and y as VERP delimiter characters.-v – 📧 Send an email report of the first delivery attempt (Postfix 2.1+). Multiple -v enable verbose logging for debugging.-X log_file (ignored) – Log mailer traffic. Use debug_peer_list and debug_peer_level instead.By design, this program is not set-user (or group) id. It is prepared to handle message content from untrusted, possibly remote, users.
However, like most Postfix programs, this program does not enforce a security policy on its command-line arguments. Instead, it relies on the UNIX system to enforce access policies based on the effective user and group IDs of the process. Concretely, this means that running Postfix commands as root (from sudo or equivalent) on behalf of a non-root user is likely to create privilege escalation opportunities.
If an application runs any Postfix programs on behalf of users that do not have normal shell access to Postfix commands, then that application MUST restrict user-specified command-line arguments to avoid privilege escalation.
/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 -.
Problems are logged to syslogd(8) or postlogd(8), and to the standard error stream.
MAIL_CONFIG – 📁 Directory with Postfix configuration files.MAIL_VERBOSE (value does not matter) – Enable verbose logging for debugging.MAIL_DEBUG (value does not matter) – Enable debugging with an external command, as specified with debugger_command.NAME – 👤 The sender full name. Used only with messages that have no From: header. See also -F option.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.
Available with Postfix 2.9 and later:
sendmail_fix_line_endings (always) – Controls how the Postfix sendmail command converts email message line endings from <CR><LF> into UNIX format (<LF>).The DEBUG_README file gives examples of how to troubleshoot a Postfix system.
debugger_command (empty) – External command to execute when a Postfix daemon program is invoked with -D.debug_peer_level (2) – Increment in verbose logging level when a nexthop destination, remote client or server name or network address matches a pattern in debug_peer_list.debug_peer_list (empty) – Optional list of patterns that, if matched, cause verbose logging level to increase by $debug_peer_level.Available in Postfix version 2.2 and later:
authorized_flush_users (static:anyone) – List of users authorized to flush the queue.authorized_mailq_users (static:anyone) – List of users authorized to view the queue.authorized_submit_users (static:anyone) – List of users authorized to submit mail with sendmail(1) (and with privileged postdrop(1) helper).bounce_size_limit (50000) – Maximal amount of original message text sent in a non-delivery notification.fork_attempts (5) – Maximal number of attempts to fork() a child process.fork_delay (1s) – Delay between fork() attempts.hopcount_limit (50) – Maximal number of Received: headers allowed in primary message headers.queue_run_delay (300s) – Time between deferred queue scans by the queue manager; prior to Postfix 2.4 default was 1000s.The ETRN_README file describes configuration and operation details for the Postfix "fast flush" service.
fast_flush_domains ($relay_domains) – Optional list of destinations eligible for per-destination logfiles with queued mail.The VERP_README file describes configuration and operation details of Postfix support for variable envelope return path addresses.
default_verp_delimiters (+=) – The two default VERP delimiter characters.verp_delimiter_filter (-=+) – Characters Postfix accepts as VERP delimiter characters on the sendmail command line and in SMTP commands.alias_database (see 'postconf -d' output) – Alias databases for local(8) delivery updated with newaliases or sendmail -bi.command_directory (see 'postconf -d' output) – Location of all postfix administrative commands.config_directory (see 'postconf -d' output) – Default location of Postfix main.cf and master.cf.daemon_directory (see 'postconf -d' output) – Directory with Postfix support and daemon programs.default_database_type (see 'postconf -d' output) – Default database type for newaliases(1), postalias(1), and postmap(1).delay_warning_time (0h) – Time after which sender receives a copy of message headers of still-queued mail.import_environment (see 'postconf -d' output) – List of environment parameters a privileged Postfix process imports from a non-Postfix parent, or name=value overrides.mail_owner (postfix) – UNIX account that owns the Postfix queue and most daemon processes.queue_directory (see 'postconf -d' output) – Location of Postfix top-level queue directory.remote_header_rewrite_domain (empty) – If empty, don't rewrite message headers from remote clients; otherwise rewrite and append domain to incomplete addresses.syslog_facility (mail) – Syslog facility of Postfix logging.syslog_name (see 'postconf -d' output) – Prefix prepended to process name in syslog records.Postfix 3.2 and later:
alternate_config_directories (empty) – List of non-default Postfix configuration directories that may be specified with -c config_directory (or -C for sendmail) or via MAIL_CONFIG.multi_instance_directories (empty) – Optional list of non-default Postfix configuration directories for additional instances that share executable files and documentation with the default instance, and are started/stopped together./var/spool/postfix – mail queue/etc/postfix – configuration filesUse postconf readme_directory or postconf html_directory to locate this information.
The Secure Mailer license must be distributed with this software.
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
Generated by phpman v4.9.26-5-g7740029 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-08-09 19:43 @216.73.216.150
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)