[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Commands Reference, Volume 5

sendmail Command


Routes mail for local or network delivery.


/usr/lib/sendmail [ -B Type ] [ -ba | -bd -bD | -bh | -bH | -bi | -bm | -bp | -bs | -bt | -bv | [ -CFile ] [ -dValue ] [ -FFullName ] [ -fName ] [ -hNumber ] [ -i] [ -n] [ -N Dsn ] [ -O Option=Value ] [ -oOption [ Value ]] [ -p Protocol ] [ -q [ Time ]] [ -qISubstr ] [ -qRSubstr] [ -qSSubstr] [ -R Return] [ -t ] [ -U ] [ -V Envid ] ] [ -v ] [ -X LogFile ] Address

Note: The Address parameter is optional with the -bd, -bi, -bp, -bt, and -q Time flags.


Note: On sendmail V8.7 (AIX 4.2 and later), name resolution ordering is DNS, NIS, then local. If you wish to override this specify an /etc/netsvc.conf file or NSORDER environment variable.

The sendmail command receives formatted text messages and routes the messages to one or more users. Used on a network, the sendmail command translates the format of the header information of the message to match the requirements of the destination system. The program determines the network of the destination system by using the syntax and content of the addresses.

The sendmail command can deliver messages to:

The sendmail command is not intended as a user interface routine; other commands provide user-friendly interfaces. Use the sendmail command only to deliver preformatted messages.

The sendmail command reads standard input for message text. The sendmail command sends a copy of the message to all addresses listed whenever it reads an end of the message character, either an end-of-file (Ctrl-D) control sequence or a single period on a line.

Using the Configuration File

The sendmail command uses a configuration file (the /etc/sendmail.cf file by default) to set operational parameters and to determine how the command parses addresses. This file is a text file that you can edit with other text editors. After modifying sendmail.cf, refresh the sendmail daemon.

The current process ID of the sendmail command is stored in the /etc/sendmail.pid file. Issue the kill -1 command as follows to have the sendmail command reread the newly edited sendmail.cf:

kill -1 `cat /etc/sendmail.pid`

If the srcmstr command is running, you may issue the refresh command, as follows, to build the configuration database, the aliases database, and the NLS database again.

refresh -s sendmail

The sendmail command rereads these databases and continues operation with the new data.

Defining Aliases

The sendmail command allows you to define aliases to use when the sendmail command handles the local mail. Aliases are alternate names that you can use in place of elaborate network addresses. You can also use aliases to build distribution lists.

Define aliases in the /etc/aliases file. This file is a text file you can edit. The sendmail command uses a database version of this file. You must build a new alias database by running the sendmail -bi command or the newaliases command before any changes made to the /etc/aliases file become effective.

Note: When defining aliases in the /etc/aliases file, use only lowercase characters for nested aliases. Uppercase characters on the right-hand side of an alias are converted to lowercase before being stored in the Database Manager (DBM) database. In the following example, mail sent to testalias fails, because TEST is converted to test when the second line is stored.
TEST: user@machine
testalias: TEST

Every system must have a user or user alias designated as the postmaster alias. The default postmaster alias is a root file. You can assign this alias to a different user in the /etc/aliases file. The postmaster alias allows other users outside your system to send mail to a known ID and to get information about mailing to users on your system. Also, users on your system can send problem notifications to the postmaster ID.


-B Passes bosy type information. This flag applies only to 4.2 or later.
Note: The -b flags are mutually exclusive.
-ba Starts the sendmail command in ARPANET mode. All input lines to the command must end with a carriage return and a line feed (CR-LF). The sendmail command generates messages with a CR-LF at the end and looks at the From: and Sender: fields to find the name of the sender.
-bd Starts the sendmail command as a daemon running in the background as a Simple Mail Transfer Protocol (SMTP) mail router.
-bD Starts the sendmail command as a daemon running in the foreground as a Simple Mail Transfer Protocol (SMTP) mail router.
-bh Prints the persistent host status database.
-bH Purges the persistent host status database.
-bi Builds the alias database from information defined in the /etc/aliases file. Running the sendmail command with this flag is the same as running the /usr/sbin/newaliases command.
-bm Delivers mail in the usual way. (This is the default.)
-bp Prints a listing of the mail queue. Running the sendmail command with this flag is the same as running the /usr/sbin/mailq command.
-bs Uses the simple mail transfer protocol (SMTP) as described in RFC821 to collect mail from standard input. This flag also includes all of the operations of the -ba flag that are compatible with SMTP.
-bt Starts the sendmail command in address test mode. This mode allows you to enter interactive addresses and watch as the sendmail command displays the steps it takes to parse the address. At the test-mode prompt, enter a rule set or multiple rule sets separated by commas and an address. Use this mode for debugging the address parsing rules in a new configuration file. This flag uses the compiled version of the configuration file.
-bv Starts the sendmail command with a request to verify the user IDs provided in the Address parameter field of the command. The sendmail command responds with a message telling which IDs can be resolved to a mailer command. It does not try to collect or deliver a message. Use this mode to validate the format of user IDs, aliases, or mailing lists.
-C File Starts the sendmail command using an alternate configuration file specified by the File variable. Use this flag together with -bt to test a new configuration file before installing it as the running configuration file.
-d Value Sets the debugging value to the value specified by the Value variable. The only valid value is 21.n, where n is any nonzero integer. This produces information regarding address parsing and is typically used with the -bt flag. Higher values of n produce more verbose information.
-F FullName Sets the full name of the sender to the string provided in the FullName variable.
-f Name Sets the name of the sender of the mail. Only administrative user IDs designated in the configuration file with the T control line, or user IDs supplied by the Name variable can use this flag.
-h Number Sets the hop count to the value specified by the Number variable. The hop count is the number of times that the message has been processed by an SMTP router (not just the local copy of the sendmail command). The mail router increments the hop count every time the message is processed. When it reaches a limit, the message is returned with an error message in order to prevent infinite loops in the mail system.
-i Number Ignore dots alone on lines by themselves in incoming messages. This should be set if you are reading data from a file.
-N Dsn Set delivery status notification conditions to DSN. The delivery status notification conditions can be: "never" for no notifications or for a comma separated list of the values, "failure" for notification if delivery failed, "delay" for notification if delivery is delayed, and "success" for notification when the message is successfully delivered.
-n Prevents the sendmail command from interpreting aliases.
-O Option=Value Sets Option to the specified Value. Use for long-form option names. This flag applies only to AIX Version 4.2 or later.
-o Option [ Value ] Sets the Option variable. If the option is a valued option, you must also specify a value for the Value variable.
Note: For valid values, see "Options for the sendmail Command in the sendmail.cf File" in AIX Version 4.3 System Management Guide: Communications and Networks.
-p Protocol Sets the sending protocol. We recommend to set this. You can set Protocol in the form Protocol:Host to set both the sending protocol and the sending host. For example, -pUUCP:uunet sets the sending protocol to UUCP and the sending host to uunet. Some existing programs use -oM flag to set the r and s macros, which is equivalent to using the -p flag. This flag applies only to 4.2 or later.
-qISubstr Limits process jobs to those containing substr as a substring of the queue ID.
-qRSubstr Limits process jobs to those containing substr as a substring of one of the recipients.
-qSSubstr Limits process jobs to those containing substr as a substring of the sender.
-q [ Time ] Processes saved messages in the queue at the intervals specified by the Time variable. If the Time variable is not specified, this flag processes the queue at once.
-RReturn Sets the amount of the message to be returned if the message bounces. The return parameter can be "full" to return the entire message or "hdrs" to return only the headers.
-t Sends the message to the recipients specified in the To: , Cc: , and Bcc: fields of the message header, as well as to any users specified on the command line.
-U Sets initial (user) submission. This should always be set when called from a user agent such as Mail or exmh and should never be set when called by a network delivery agent such as rmail.
-VEnvid Sets the original envelope ID. This is propagated across SMTP to servers that support DSNs and is returned in DSN-compliant error messages.
-v Starts the sendmail command in verbose mode. The sendmail command displays messages regarding the status of transmission and the expansion of aliases.
-X LogFile Logs all traffic in and out of sendmail in LogFile for debugging mailer problems. Use this flag sparingly, since it produces a lot of data very quickly. This flag applies only to 4.2 or later.

You can also set or remove the sendmail configuration processing options. The person responsible for the mail system uses these options. To set these options, use the -o flag on the command line or the O control line in the configuration (/etc/sendmail.cf) file.


Auditing Events:

Event Information
SENDMAIL_Config Configuration event
SENDMAIL_ToFile File-creation event

Exit Status

The sendmail command returns exit status values. These exit values are defined in the /usr/include/sysexits.h file. The following table summarizes the meanings of these return values:

EX_CANTCREAT The sendmail command cannot create a file that the user specified.
EX_CONFIG An error was found in the format of the configuration file.
EX_DB An error occurred while trying to gain access to a database.
EX_IOERR An error occurred during I/O.
EX_NOHOST The sendmail command could not recognize the specified host name.
EX_NOPERM The user does not have permission to perform the requested operation.
EX_NOUSER The sendmail command could not recognize a specified user ID.
EX_OK The sendmail command successfully completed.
EX_OSERR A temporary operating system error occurred. An example of such an error is a failure to create a new process.
EX_OSFILE A system file error occurred. For example, a system file (such as /etc/passwd) does not exist, cannot be opened, or has another type of error preventing it from being used.
EX_PROTOCOL The remote system returned something that was incorrect during a protocol exchange.
EX_SOFTWARE An internal software error occurred (including bad arguments).
EX_TEMPFAIL The sendmail command could not create a connection to a remote system. Try the request again later.
EX_UNAVAILABLE A service or resource that the sendmail command needed was not available.
EX_USAGE The command syntax was not correct.
EX_NOLHOST The local host name is not defined.


/usr/sbin/sendmail Contains the sendmail command.
/usr/sbin/mailq Contains the mail queue.
/usr/sbin/newaliases Contains the alias database.
/usr/sbin/mailstats Contains statistics found in the /usr/lib/sendmail.st file.
/etc/aliases Contains the text version of the sendmail command aliases.
/etc/aliases.dir Contains DBM formatted database for aliases.
/etc/aliases.pag Contains DBM formatted database for aliases.
/etc/sendmail.cf Contains the text version of the sendmail configuration file.
/etc/sendmail.st Contains mail routing statistics information.
/usr/lib/smdemon.cleanu Maintains aging copies of the log file found in the /var/spool/mqueue directory.
/var/spool/mqueue Contains the temporary files and the log file associated with the messages in the mail queue.
/usr/bin/uux Contains the mailer command to deliver Basic Networking Utilities (BNU) mail.
/usr/bin/bellmail Contains the mailer command to deliver local mail.

Related Information

The bellmail command, kill command, mail, Mail command, mailq command, mailstats command, newaliases command, refresh command, uux command.

The srcmstr daemon.

BNU Introduction for System Management, Mail Overview for System Management, TCP/IP Overview for System Management in AIX Version 4.3 System Management Guide: Communications and Networks.

Mail Overview in AIX Version 4.3 System User's Guide: Communications and Networks.

Peek, Jerry. MH and xmh: E-mail for Users and Programmers. Sebastopol, CA: O'Reilly & Associates, 1992.

[ Previous | Next | Contents | Glossary | Home | Search ]