Previous Section Next Section

$u

Address part of a delivery agent triple All versions

The parse rule set 0 (Section 19.5) is used to resolve the recipient address into a triple: the delivery agent (with $#), the host part of the address (with $@), and the recipient's address (with $:). The recipient's address is then processed by rule set 2 (the generic rule set for all recipient addresses), then by the rule set indicated by the R= equate of the delivery agent (the custom recipient address processing), and finally by the final rule set 4 (post-processing for all addresses).

If the delivery agent has the F=A flag set (F=A), that rewritten recipient's address is looked up in the aliases file and replaced with its alias if one exists. If it is not replaced and if the F=5 flag (F=5) is set, the address is rewritten by the localaddr rule set 5 to possibly pick a new delivery agent and repeat this process.[21]

[21] Prior to V8.7 this behavior was all tied to the local delivery agent.

After aliasing, the rewritten recipient's address is then assigned to $u. If the delivery agent's F=w flag (F=w) is set,[22] the value of $u is then used to look up information about that user with the method defined by the MailboxDatabase option (MailboxDatabase)[23] The user's home directory is made the value of $z, which in turn is used to access the user's ~/.forward and dead.letter files.

[22] Prior to V8.7, looking up the user's home directory was tied to the local delivery agent.

[23] Prior to V8.12, the getpwnam(3) routine was used.

For all delivery agents the final value of $u can be used as a component of the delivery agent's A= (A=) equate. For example:

A=uux - $h!rmail ($u)

Note that $u is special (See this section) in delivery agent A= equates. If it is absent, sendmail speaks SMTP or LMTP. If it is present and the F=m flag (F=m) is also present, the argument containing $u is repeated as many times as there are multiple recipients.

In V8 sendmail, $u is also set to the original recipient (prior to aliasing) while the message headers are first being read. Therefore, the original recipient information is available for use in the Received: header line, but only if there is just a single recipient.

$u is transient. If it is defined in the configuration file or in the command line, that definition is ignored by sendmail. Note that a $& prefix is necessary when you reference this macro in rules (that is, use $&u, not $u).

    Previous Section Next Section