|The argv for this delivery agent||All versions|
Under V8 sendmail's mc configuration you can define the A= delivery agent equate using one of the handy mc macros provided. With the local delivery agent, for example, you can change the A= equate like this:
define(`LOCAL_MAILER_ARGS', `put.local -l -d $u')
See the section describing a particular delivery agent to find an appropriate mc macro with which to redefine the A= for that delivery agent. See Table 20-1, in Section 20.4, for a guide to all delivery agents. And note that when $u appears in an A= equate, it should always be last because there might be multiple recipients.
In general, the definitions in the cf/ostype subdirectory are pretuned in a way that is best for most sites. If you want to make changes, remember that each definition that you put in your mc file replaces the definition in cf/ostype. Therefore, it's best to copy an existing definition and modify it for your own use. Just be sure you don't omit something important.
For network delivery via the P=[IPC] delivery agent, the A= delivery agent equate is usually declared like this:
The value in $h is the value returned by the parse rule set 0's $@ operator and is usually the name of the host to which sendmail should connect. During delivery the sendmail program expands this hostname into a possible list of MX records. It attempts delivery to each MX record. If all delivery attempts fail and if the V8 FallbackMXhost option (FallbackMXhost) is set, delivery is attempted to that fallback host. In all cases, if there are no MX records, delivery is attempted to the A or AAAA record instead.
 Unless (V8.8 and above) the F=0 delivery agent flag is set (F=0 (zero)), or unless the hostname is surrounded by square brackets.
Beginning with V8 sendmail, $h (possibly as returned by the parse rule set 0) can be a colon-separated list of hosts. The sendmail program attempts to connect to each in turn, left to right:
Here, it tries to connect to hostA first. If that fails, it next tries hostB, and so on. As usual, trying a host means trying its MX records first, or its A or AAAA record if there are no MX records.
The host (as $h) is usually the only argument given to TCP. But, strictly speaking, TCP can accept two arguments, like this:
A=TCP hostlist port
The port is usually omitted and so defaults to 25. However, a port number can be included to force sendmail to connect on a different port.
To illustrate, consider the need to force mail to a gateway machine that must always be delivered on a particular port. First, design a new delivery agent that uses TCP for transport:
Mgateway, P=[IPC], ..., A=TCP gateway.domain $h
Here, any mail that selects the gateway delivery agent is transported over the network (the TCP) to the machine gateway.domain. The port number is carried in $h, which usually carries the hostname.
Next, design a rule in the parse rule set 0 that selects this delivery agent:
R$+ < @ $+ .gateway > $* $#gateway $@ 26 $: $1 < @ $2 .gateway> $3
This rule selects the gateway delivery agent for any address that ends in .gateway. The host part that is returned by the $@ is the port number to use. The $: part (the address) is passed in the envelope. Note that the gateway also has to be listening on the same port for this to work.
In the event that you wish to carry the port number in a sendmail macro, you can do so by specifying the host with $h. For example:
Mgateway, P=[IPC], ..., A=TCP $h $P R$+ < @ $+ .gateway > $* $#gateway $@ $2 $: $1 < @ $2 .gateway> $3
Then sendmail can be run with the command-line argument:
to cause gateway mail to go out on port 26.
The $u sendmail macro is special in the A= delivery agent equate's field. If $u does not appear in the array, sendmail assumes the program in the P= delivery agent equate speaks SMTP, or LMTP if the delivery agent has the F=z flag set (F=z). If $u does appear in the array, sendmail assumes that the program in P= will speak neither SMTP nor LMTP. Consequently, you should never use a $u when defining mail delivery agents that speak SMTP or LMTP. All agents that use [IPC] in their P= delivery agent equate's field must use SMTP.
If $u appears and the F=m delivery agent flag is also specified, the argument containing $u is repeated as many times as there are recipients. For example, a typical uucp delivery agent definition looks like this:
Muucp, P=/bin/uux, F=m sDFMhuU, S=13, R=23, A=uux - -r $h!rmail ($u) note note
In this example, the m delivery agent flag is set in the F= delivery agent equate's field, which tells sendmail that this delivery agent can deliver to multiple recipients simultaneously. The $u sendmail macro is also included as one of the arguments specified by the A= command-line array. Thus, if mail is sent with this delivery agent to multiple recipientssay, jim, bill, and joethe ($u) argument is repeated three times, once for each recipient:
 When $u is used as part of a UUCP delivery agent's A= array, it should be parenthesized. This is what the uux(1) program expects.
uux - -r $h!rmail (jim) (bill) (joe)
Beginning with V8.10 sendmail, delivery can be made to Unix domain sockets. This is enabled by defining a delivery agent that has P= defined as [IPC] and A= defined with FILE, followed by the full pathname of the Unix domain socket.
To illustrate, consider a site that has devised a daemon which will deliver local mail into a central database. Such a daemon might be best designed to listen for inbound email on a Unix domain socket, and to receive that mail with the LMTP protocol. Should such a daemon exist, you could tie sendmail into it with a simple setup such as this:
define(`confLOCAL_MAILER', `dbd') MAILER_DEFINITIONS Mdbd, P=[IPC], F=lsDFMmnqSXzA5@/:|, S=EnvFromL/HdrFromL, R=EnvToL/HdrToL, T=DNS/RFC822/SMTP, A=FILE /var/run/dbd
Here, in our mc configuration file, we declare that the dbd delivery agent will become our preference for all local delivery by defining the confLOCAL_MAILER mc configuration macro (Section 220.127.116.11).
Then, under MAILER_DEFINITIONS, we define the new dbd delivery agent. Its P= is defined as [IPC], which tells sendmail that delivery will be over a socket connection. The FILE following the A= tells sendmail that the socket will be a Unix domain socket. The /var/run/dbd path is the full pathname of the Unix domain socket. If the socket does not exist, delivery will fail.
 It is the responsibility of the listening program to make certain the socket exists. In an rc file, you should launch the listening program before you launch sendmail.
The F=l delivery agent flag (F=l (lowercase L)) tells sendmail that this delivery agent handles final, local delivery. The F=z delivery agent flag (F=z) tells sendmail to deliver using the LMTP protocol.