Previous | Table of Contents | Next |
The following sections describe the details of rewriting rules and mailer descriptions.
Macros are referenced using the format $c x, in which x is the name of the macro to be matched (LHS) or inserted (RHS). Lowercase letters are reserved for special semantics, and some special characters are reserved to provide conditionals.
The macros shown in Table 4-6 must be defined to transmit information into sendmail.
Macro | Description |
---|---|
e | The SMTP entry message |
j | The official domain name for this site |
l | The format of the UNIX From line |
n | The name of the daemon (for error messages) |
o | The set of separators in names |
q | The default format of sender names |
The $e macro is printed when SMTP starts. The first word of $e is the $j macro. The $j macro needs to be in domain-name format. The $o macro is a list of characters treated as tokens. This list separates the tokens when scanning. For example, if y is in the $o macro, the input xyzzy is scanned as four tokens: x, y, zz, and y. Finally, the $q macro specifies how a sender name must appear in a message when it is created. For example, the SunOS 5.x default special macros are as follows:
De$j Sendmail $v ready at $b* DnMAILER-DAEMON DlFrom $g $d Do.:%@!^=/ Dq$g$?x ($x)$.| Dj$H.$D
You do not need to change any of these macros except under unusual circumstances. For example, you might want to change the banner asterisk (*) for security. You might want to change | or to make several hosts look like one host.
An acceptable alternative for the $q macro is
$?x$x $.<$g>
These correspond to the following two formats:
nowicki@sun.COM (Bill Nowicki) Bill Nowicki <nowicki@sun.COM>
Some macros are defined by sendmail for use in mailer arguments or for other contexts. These macros are shown in Table 4-7.
Macro | Description |
---|---|
a | The origination date in ARPANET format |
b | The current date in ARPANET format |
c | The hop count |
d | The date in UNIX (ctime) format |
f | The sender (from) name |
g | The sender name relative to the recipient |
h | The recipient host |
i | The queue ID |
m | The domain name |
p | Sendmail's process ID |
r | Protocol used |
s | Sender's host name |
t | A numeric representation of the current time |
u | The recipient user |
v | The version number of sendmail |
w | The host name of this site |
x | The full name of the sender |
z | The home directory of the recipient |
You can use three types of dates. The $a and $b macros are in ArpaNet format; $a is the time as extracted from the Date: line of the message (if there was one), and $b is the current date and time (used for postmarks). If no Date: line is found in the incoming message, $a is set to the current time as well. The $d macro is equivalent to the $a macro in UNIX (ctime) format.
The $f macro is the ID of the sender as originally determined; when mailing to a specific host, the $g macro is set to the name of the sender relative to the recipient. For example, suppose the sender eric sends to bollard@matisse from the machine ucbarpa. In this case, the $f macro is eric and the $g macro is eric@ucbarpa.
The $x macro is set to the full name of the sender, which can be determined in several ways:
When sending, the $h, $u, and $z macros get set to the host, user, and home directory (if local) of the recipient. The first two are set from the $@ and $: part of the rewriting rules, respectively.
The $p and $t macros create unique strings (for example, for the Message-Id: field). The $i macro is set to the queue ID on this host; if put into the timestamp line, it can be useful for tracking messages. The $v macro is the version number of sendmail; this normally is placed in timestamps and can be extremely useful for debugging. Some people feel, however, that it is a security risk, as it may provide outsiders with information about your network setup. The $w macro is set to the primary name of this host as given by the Host table for NIS+, or gethostname(1) and gethostbyname(3) for NIS. The $c field is set to the hop count that is, the number of times this message has been processed which can be determined by the -h flag on the command line or by counting the timestamps in the message.
The $r and $s fields are set to the protocol used to communicate with sendmail and the sending host name. You can specify conditionals by using the syntax:
$?x text1 $| text2 $
This syntax inserts text1 if the macro $x is set, and text2 otherwise. The else (c $|) clause may be omitted.
The class $=w is the set of all names by which this host is known. It can be used to delete local host names. The class $=m is set to the list of domain names to which this host belongs.
Previous | Table of Contents | Next |