HPlogo HP-UX Reference Volume 2 of 5 > s

sendmail(1M)

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

NAME

sendmail — send mail over the Internet

SYNOPSIS

/usr/sbin/sendmail [mode] [flags] [address ...]

DESCRIPTION

sendmail sends a message to one or more recipients or addresses, routing the message over whatever networks are necessary. sendmail does internetwork forwarding as necessary to deliver the message to the correct place.

sendmail is not intended as a user interface routine. Other programs provide user-friendly front ends. sendmail is used only to deliver pre-formatted messages.

With no flags specified in the command line, sendmail reads its standard input up to an end-of-file or a line consisting only of a single dot (.) and sends a copy of the message found there to all of the addresses listed in the command line. It determines the network(s) to use based on the syntax and contents of the addresses, according to information in the sendmail configuration file. The default configuration file is /etc/mail/sendmail.cf.

Local addresses are looked up in a file and aliased appropriately. Aliasing can be prevented by preceding the address with a backslash (\). Normally the sender is not included in any alias expansions. For example, if `john' sends to `group', and `group' includes `john' in the expansion, then the letter will not be delivered to `john'.

If newaliases is invoked, sendmail will rebuild the alias database. newaliases is identical to sendmail -bi. See newaliases(1M). Mail that is temporarily undeliverable is saved in a mail queue. If mailq is invoked, sendmail will print the contents of the mail queue. The mail queue files are in the directory /var/spool/mqueue. mailq is identical to sendmail -bp. See mailq(1).

Arguments

sendmail recognizes the following arguments:

mode

A mode selected from those described in the "Modes" subsection below. Only one mode can be specified. The default is -bm.

address

The address of a recipient. Several addresses can be specified.

flags

A flag selected from those described in the "Flags" subsection below. Several flags can be specified.

Modes

sendmail operates in one of the following modes. The default is -bm, deliver mail in the usual way.

-ba

Go into ARPANET mode. All input lines must end with a CR-LF, and all messages will be generated with a CR-LF at the end. Also, the ``From:'' and ``Sender:'' fields are examined for the name of the sender.

-bd

Run as a daemon. sendmail will fork and run in background listening on socket 25 for incoming SMTP connections.

-bD

Run as a daemon, but run in foreground.

-bh

Print the persistent host status database.

-bH

Purge the persistent host status database.

-bi

Initialize the alias database for the mail aliases file. newaliases is identical to sendmail -bi. See newaliases(1M).

-bm

Deliver mail in the usual way (default).

-bp

Print a listing of the mail queue. mailq is identical to sendmail -bp. See mailq(1).

-bs

Use the SMTP protocol as described in RFC821 on standard input and output. This flag implies all the operations of the ba flag that are compatible with SMTP.

-bt

Run in address test mode. This mode reads addresses and shows the steps in parsing; it is used for debugging configuration tables.

-bv

Verify names only - do not try to collect or deliver a message. Verify mode is normally used for validating users or mailing lists.

Flags

sendmail recognizes the following flags:

-Btype

Set the body type, 7BIT or 8BITMIME.

-Cfile

Use alternate configuration file. sendmail refuses to run as root if an alternate configuration file is specified.

-dX

Set debugging value to X.

-Ffullname

Set the full name of the sender.

-fname

Sets the name of the ``from'' person (i.e., the sender of the mail) to name. If the user of the -f option is not a ``trusted'' user (normally root, daemon, and network) and if the name set using the -f option and the login name of the person actually sending the mail are not the same, it results in an X-Authentication-Warning in the mail header.

-hN

Set the hop count to N. The hop count is incremented every time the mail is processed. When it reaches a limit, the mail is returned with an error message, the victim of an aliasing loop. If not specified, ``Received:'' lines in the message are counted.

-i

Ignore dots alone on lines by themselves in incoming messages. This should be set if you are reading from a file.

-n

Do not do aliasing.

-Ndsn

Set delivery status notification conditions. The valid conditions with which dsn can be set are as follows:

never

For no notifications.

failure

If delivery failed.

delay

If delivery is delayed.

success

When message is successfully delivered.

-Ooption=value

Set option option to a specified value. Options are described below in ""Processing Options."

-ox=value

Set option x to the specified value. Options are described below in "Processing Options."

-pprotocol

Set the name of the protocol used to receive the message. This can be a simple protocol name such as ``UUCP'' or a protocol and hostname, such as ``UUCP:ucbvax''.

-qtime

Process saved messages in the queue at given intervals. If time is omitted, process the queue once. time is given as a tagged number, with s being seconds, m being minutes, h being hours, d being days, and w being weeks. For example, -q1h30m or -q90m would both set the timeout to one hour thirty minutes. If time is specified, sendmail will run in background. This option can be used safely with bd.

-qIsubstr

Limit processed jobs to those containing substr as a substring of the queue id.

-qRsubstr

Limit processed jobs to those containing substr as a substring of one of the recipients.

-qSsubstr

Limit processed jobs to those containing substr as a substring of the sender.

-rname

An alternate and obsolete form of the f flag.

-Rreturn

Set the amount of the message to be returned if the message bounces. The values that can be set for return are as follows:

full

To return the entire message

hdrs

To return only the headers.

-t

Read message for recipients. To:, Cc:, and Bcc: lines will be scanned for recipient addresses. The Bcc: line will be deleted before transmission.

-U

Initial (user) submission. This flag should always be set when sendmail is called from a user agent such as mail or elm. This flag should never be set when called from a network delivery agent such as rmail.

-v

Go into verbose mode. Alias expansions will be announced, etc.

-Venvid

Set the original envelope identification. This is propagated across SMTP to servers that support DSN's (delivery status notification) and is returned in DSN-compliant error messages.

-Xlogfile

Log all traffic in and out of mailers in the indicated log file. This should only be used as a last resort for debugging mailer bugs. It will log a lot of data very quickly.

--

Stop processing command flags and use the rest of the arguments as addresses.

Processing Options

There are also a number of processing options that may be set. Normally these will only be used by a system administrator. Options may be set either on the command line using the -o flag or in the configuration file, /etc/mail/sendmail.cf. The options are:

AliasFile=file

Use alternate alias file.

HoldExpensive

On mailers that are considered ``expensive'' to connect to, do not initiate immediate connection. This requires queuing.

CheckpointInterval=N

Checkpoint the queue file after every N successful deliveries (default 10). This avoids excessive duplicate deliveries when sending to long mailing lists interrupted by system crashes.

DeliveryMode=x

Set the delivery mode to x. Delivery modes are

i

interactive (synchronous) delivery.

b

background (asynchronous) delivery.

q

queue only; expect the messages to be delivered the next time that the queue is run.

d

deferred; the same as q except that database lookups (DNS and NIS lookups) are avoided.

ErrorMode=x

Set error processing to mode x. Valid modes are

m

mail back the error message.

w

``write'' back the error message (or mail it back if the sender is not logged in).

p

print the errors on the terminal (default).

q

throw away error messages (only exit status is returned).

e

do special processing for the BerkNet.

If the text of the message is not mailed back by modes m or w and if the sender is local to this machine, a copy of the message is appended to the file dead.letter in the sender's home directory.

SaveFromLine

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

MaxHopCount=N

The maximum number of times a message is allowed to ``hop'' before it is considered in a loop.

IgnoreDots

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

SendMimeErrors

Send error messages in MIME format.

ConnectionCacheTimeOut=timeout

Set connection cache timeout.

ConnectionCacheSize=N

Set connection cache size.

Loglevel=n

The log level.

MeToo

Send to ``me'' (the sender) also if the sender is in an alias expansion.

CheckAliases

Validate the right hand side of aliases during a newaliases command. See newaliases(1M).

OldStyleheaders

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). If set, an adaptive algorithm is used that will correctly determine the header format in most cases.

QueueDirectory=queuedir

Select the directory in which to queue messages.

StatusFile=file

Save statistics in the named file.

Timeout.queuereturn=time

Set the timeout on undelivered messages in the queue to the specified time. After delivery has failed (e.g., because of a host being down) for this amount of time, the failed messages will be returned to the sender. The default is three days.

UserDatabaseSpec=userdatabase

If set, a user database is consulted to get forwarding information. You can consider this an adjunct to the aliasing mechanism, except that the database is intended to be distributed; aliases are local to a particular host.

ForkEachJob

Fork each job during queue runs. May be convenient on memory-poor machines.

SevenBitInput

Strip incoming messages to seven bits.

EightBitMode=mode

Set the handling of eight bit input to seven bit destinations. Mode can be set to the following values

m

Convert to seven-bit MIME format.

p

Pass it as eight bits.

s

Bounce the mail.

MInQueueAge=timeout

Sets how long a job must ferment in the queue in between attempts to send it.

DefaultCharSet=charset

Sets the default character set used to label 8-bit data that is not otherwise labeled.

DialDelay=sleeptime

If opening a connection fails, sleep for sleeptime seconds and try again. Useful on dial-on-demand sites.

NoRecipientAction=action

Set the behaviour when there are no recipient headers (To:, Cc: or Bcc:) in message to action. The different values that can be set for action are

none

Leaves the message unchanged.

add-to

Adds a To: header with the envelope recipients.

add-apparently-to

Adds an Apparently-To: header with the envelope recipients.

add-bcc

Adds an empty Bcc:

add-to-undisclosed

Adds a header reading To:undisclosed-recipients:

MaxDaemonChildren=N

Sets the maximum number of children that an incoming SMTP daemon will allow to spawn at any time to N.

ConnectionRateThrottle=N

Sets the maximum number of connections per second to the SMTP port to N. header.

Aliases

You can set up system aliases and user forwarding. The alias and .forward files are described in the aliases(5) manpage.

EXIT STATUS

sendmail returns an exit status describing what it did. The codes are defined in <sysexits.h>:

EX_OK

Successful completion on all addresses.

EX_NOUSER

User name not recognized.

EX_UNAVAILABLE

Catchall meaning necessary resources were not available.

EX_SYNTAX

Syntax error in address.

EX_SOFTWARE

Internal software error, including bad arguments.

EX_OSERR

Temporary operating system error, such as ``cannot fork'' .

EX_NOHOST

Host name not recognized.

EX_TEMPFAIL

Message could not be sent immediately, but was queued.

AUTHOR

The sendmail command was developed by the University of California, Berkeley, and originally appeared in BSD 4.2. This version of HP-UX sendmail originally came from sendmail 8.7.1.

FILES

$HOME/.forward

User's mail forwarding file

$HOME/dead.letter

User's failed message file

Except for the /etc/mail/sendmail.cf file and the daemon process ID file, the below mentioned default pathnames are all specified in the configuration file, /etc/mail/sendmail.cf. These default file names can be overridden in the configuration file.

/etc/mail/aliases

raw data for alias names

/etc/mail/aliases.db

data base of alias names

/etc/mail/sendmail.cf

configuration file

/usr/share/lib/sendmail.hf

help file

/etc/mail/sendmail.st

collected statistics

/var/spool/mqueue/*

mail queue files

/etc/mail/sendmail.pid

The process id of the daemon

/etc/mail/sendmail.cw

The list of all hostnames that are recognized as local, which causes sendmail to accept mail for these hosts and attempt local delivery

/etc/nsswitch.conf

configuration file for the name-service switch

© Hewlett-Packard Development Company, L.P.