oreilly.comSafari Books Online.Conferences.


Linux in a Nutshell

This directory of Linux commands is from Linux in a Nutshell, 5th Edition.

Click on any of the 687 commands below to get a description and list of available options. All links in the command summaries point to the online version of the book on Safari Bookshelf.

Buy it now, or read it online on Safari Bookshelf.


sendmail [flags] [address...]

System administration command. sendmail is a mail transfer agent (MTA) or, more simply, a mail router. It accepts mail from a user's mail program, interprets the mail address, rewrites the address into the proper form for the delivery program, and routes the mail to the correct delivery program.

Command-line flags


End of options marker. Only addresses should follow this option.


Use local submission configuration file /etc/mail/, even when no mail is sent from the command line.


Use configuration file /etc/mail/, even when mail is sent from the command line.


Set message body type. Accepted values are 7BIT and 8BITMIME.


Set operation mode to x. Operation modes are:


Run in ARPAnet mode.


Run as a daemon.


Run as a daemon, but remain in the foreground.


Print persistent host status information.


Purge expired entries from persistent host status information.


Initialize the alias database.


Deliver mail (the default).


Print the mail queue.


Speak SMTP on input side.


Run in test mode.


Verify addresses; do not collect or deliver.

-C file

Use configuration file file.

-d level

Set debugging level.

-F name

Set full name of user to name.

-f name

Sender's name is name.


Relay message submission. Used by rmail.


Do not interpret dots on a line by themselves as a message terminator.

-h cnt

Set hop count (number of times message has been processed by sendmail) to cnt.

-L identifier

Use the specified log identifier for messages sent to syslogd.

-N conditions

Specify conditions for delivery status notification (DSN) as a comma-separated list. Accepted values are never, delay, failure, and success.


Do not alias or forward.

-O option=value

Set an option specified by its long name. Options are described in the next section.


Set an option specified by its short name X. Options are described in the next section.


Receive messages via the protocol protocol.


Process queued messages immediately, or at intervals indicated by time (for example, -q30m for every half hour).


Same as -q, but create a persistent process to handle the queue instead of initiating a new process at each time interval.


Process saved messages in the queue using the foreground process.

-qG group

Process saved messages in the named queue group.

-q[!] Isubstring

Process jobs for named queues containing substring. Use ! to process mail for all queues not containing substring.

-q[!] Qsubstring

Process quarantined messages containing substring. Use ! to process mail for recipients not containing substring.

-q[!] Rsubstring

Process jobs with recipients containing substring. Use ! to process mail for recipients not containing substring.

-q[!] Ssubstring

Process jobs from senders containing substring. Use ! to process mail from senders not containing substring.


Quarantine messages for the given reason. Use query options above to specify the message to quarantine.

-R portion

When bouncing messages, return only the specified portion of the bounced message. portion may be hdrs for headers, or full for the full message.


Read header for To:, Cc:, and Bcc: lines, and send to everyone on those lists.


Verbose mode.

-V envid

Use envid as the original envelope ID.

-X file

Log all traffic to file. Not to be used for normal logging.

Configuration options

Command-line configuration options are the same options normally set with an O in the sendmail configuration file. On the command line, they are set using -O and the option's long name. Many of these options have short-name variations that are used with the -o option. Here, we document items most likely to be useful on the command line, providing both their short- and long- name forms. Many of the commands call for timeout values. These should be given as a number followed by a letter indicating the interval: s for seconds, m for minutes, h for hours, or d for days. For example, 30s is 30 seconds, 10m is 10 minutes, and 3d is 3 days. The default is minutes when no letter is given.

Aliasfile=file, Afile

Use alternate alias file.

AliasWait=min, amin

If the D option is set, wait min minutes for the aliases file to be rebuilt before returning an alias database out-of-date warning.

BlankSub=char, Bchar

Set unquoted space replacement character.

CheckAliases, n

When running newaliases, validate the right side of aliases.

CheckpointInterval=num, Cnum

Checkpoint the queue when mailing to multiple recipients. sendmail will rewrite the list of recipients after each group of num recipients has been processed.

ClassFactor=factor, zfactor

Multiplier for priority increments. This determines how much weight to give to a message's precedence header. sendmail's default is 1800.

ConnectionCacheSize=num, knum

Specify the maximum number of open connections to cache.

ConnectionCacheTimeout=timeout, Ktimeout

Time out connections after timeout.


Restrict SMTP connections per second to num.

DefaultUser=uid[:gid] , uuid[:gid]

Use user ID and group ID for mailers instead of 1:1. If no group ID is specified, the user's default group is used.


Use the specified label for 8-bit data.

DeliveryMode=x, dx

Set the delivery mode to x. Delivery modes are d for deferred delivery, i for interactive (synchronous) delivery, b for background (asynchronous) delivery, and q for queue only (i.e., deliver the next time the queue is run).


Specify the number of seconds to wait before redialing after a connection fails.

DontPruneRoutes, R

Don't prune route addresses.

EightBitMode=mode, 8mode

Specify how to handle 8-bit input. Accepted values for mode are mimefy (convert to 7-bit), pass (send as is), or strict (bounce the message).

ErrorHeader=text, Etext

Set error-message header. text is either text to add to an error message, or the name of a file. A filename must include its full path and begin with a /.

ErrorMode=x, ex

Set error processing to mode x. Valid modes are m to mail back the error message, w to write back the error message, p to print the errors on the terminal (default), q to throw away error messages, and e to do special processing for the BerkNet.

FallbackMXhost=host, Vhost

Set fallback MX host. host should be the fully qualified domain name of the fallback host.

ForkEachJob, Y

Deliver each job that is run from the queue in a separate process. This helps limit the size of running processes on systems with very low amounts of memory.

ForwardPath=path, Jpath

Set an alternative .forward search path.

HelpFile=file, Hfile

Specify SMTP help file to use instead of /etc/mail/helpfile.

HoldExpensive, c

On mailers that are considered "expensive" to connect to, don't initiate immediate connection.

IgnoreDots, i

Do not take dots on a line by themselves as a message terminator.

LogLevel=n, Ln

Specify log level. Default is 9.


Compare local mail names to the GECOS section in the password file.


Restrict incoming SMTP daemon to no more than num child processes.

MaxHopCount=num, hnum

Allow a maximum of num hops per message.

MeToo, m

Also send to me (the sender) if I am in an alias expansion.

MinFreeBlocks=minblocks, bminblocks

Require at least minblocks on the filesystem to be free.


Wait the specified time before processing a new job in the queue.


Specify what headers, if any, to add to a message without recipient headers. Accepted values are none, add-to, add-apparently-to, add-bcc, and add-to-undisclosed.

OldStyleHeaders, o

If set, this message may have old-style headers. If not set, this message is guaranteed to have new-style headers (i.e., commas instead of spaces between addresses).

PostmasterCopy=user, Puser

Send copies of all failed mail to user (usually postmaster).

PrivacyOptions=optionlist, poptionlist

Adjust the privacy of the SMTP daemon. The optionlist argument should be a comma-separated list of the following values:


Make SMTP fully public (the default).


Require site to send HELO or ELHO before sending mail.


Require site to send HELO or ELHO before answering an address expansion request.


Like preceding argument, but for verification requests.


Deny requests to reverse the connection using extended TURN.


Deny all expansion requests.


Deny requests for verbose mode.


Deny all verification requests.


Insert special headers in mail messages advising recipients that the message may not be authentic.


Set all of the previous arguments (except public).


Don't return message body with a delivery status notification.


Turn off delivery status notification on success.


Deny untrusted users access to aliases, forwards, or include files. Restrict sendmail -bv and disallow -v.


Allow only users of the same group as the owner of the queue directory to examine the mail queue.


Limit queue processing to root and the owner of the queue directory.

QueueDirectory=dir, Qdir

Select the directory in which to queue messages.

QueueFactor=factor, qfactor

Multiplier (factor) for high-load queuing. Default is 600000.

QueueLA=load, xload

Queue messages when load level is higher than load.

QueueTimeout=timeout, Ttimeout

Set the timeout on undelivered messages in the queue to the specified time (overridden by Timeout.queuereturn).

RecipientFactor=factor, yfactor

Penalize large recipient lists by factor.

RefuseLA=load, Xload

Refuse SMTP connections when load is higher than load.

ResolverOptions=arg, I arg

Use DNS lookups and tune them. Queue messages on connection refused. The arg arguments are identical to resolver flags without the RES_ prefix. Each flag can be preceded by a plus or minus sign to enable or disable the corresponding nameserver option. There must be whitespace between the I and the first flag.

RetryFactor=inc, Zinc

Increment priority of items remaining in queue by inc after each job is processed. sendmail uses 90,000 by default.

SaveFromLine, f

Save Unix-style From lines at the front of messages.

SendMimeErrors, j

Use MIME format for error messages.

SevenBitInput, 7

Format all incoming messages in seven bits.

StatusFile=file, Sfile

Save statistics in the named file.

SuperSafe, s

Always instantiate the queue file, even when it is not strictly necessary.

TempFileMode=mode, Fmode

Set default file permissions for temporary files. If this option is missing, default permissions are 0600.


Return undelivered mail that has been in the queue longer than the specified timeout. The default is 5d (five days).

TimeZoneSpec=timezone, ttimezone

Set name of the time zone.

UseErrorsTo, l

Do not ignore Errors-To header.

UserDatabaseSpec=database, Udatabase

Consult the user database for forwarding information.

Verbose, v

Run in verbose mode.

sendmail support files


Traditional location of sendmail binary.


Link to /usr/lib/sendmail; rebuilds the alias database from information in /etc/aliases.


Prints a listing of the mail queue.


Configuration file, in text form.


Configuration file used for local message submissions.


SMTP help file.


Statistics file.


Alias file, in text form.


Alias file in dbm format. Created by newaliases


Directory in which the mail queue and temporary files reside.

Linux Resources
  • Linux Online
  • The Linux FAQ
  • Linux Kernel Archives
  • Kernel Traffic

  • Sponsored by: