The Define Macro Command

20.2.1.1 Macro and Class Definitions

For a better understanding of the presented entries, as well as others that follow, a brief explanation of the macro and class definitions follows.

20.2.1.1.1 The Define Macro Command

The define macro command — D — defines a macro and stores a value in it. Once the macro is defined, it can be used to provide the stored value to other sendmail.cf commands or directly to sendmail itself defined macros are specified by their names and the leading character. This allows sendmail configurations to be shared by many systems, simply by modifying a few system−specific macros. A macro name can be any single ASCII character. Lowercase letters are reserved for sendmails own internal macros; user−created macros use uppercase letters as names. sendmails internal macros are: Name Function a Origination date in RFC 822 format b Current date in RFC 822 format c Hop count d Date in UNIX ctime format e SMTP entry message f Sender from address g Sender address relative to the recipient h Recipient host i Queue ID j Official domain name for this site l Format of the UNIX from line n Name of the daemon for error messages o Set of operators in addresses p sendmail s PID q Default format of sender address r Protocol used s Senders host name t Numeric representation of the current time u Recipient user v Version number of sendmail w Hostname of this site x Full name of the sender z Home directory of the recipient 472 Name Value Assigned This Macro Example e SMTP entry message Dej Sendmail v ready at b j Sites official domain name Djw.D l Format of the UNIX from line DlFrom g d n Name used in error messages DnMAILER−DAEMON o Set of operators in addresses Do.:\ = q Default sender address format Dqg?x x. Note: All of the listed macros must be specified in a configuration file, but only the value assigned to macro j is usually modified. The macro D is user−defined. The definition of macro q contains a conditional: ?x x.. It tests whether macro x has a value set, and if the macro x has been set, whether the text following the conditional is interpreted. The constructs ? and . specify the beginning and the end of the conditional. This means that q is assigned the value of macro g, and the value of macro x in the parentheses if the macro x is set. The conditional can be used with an else construct, which is |. An example explaining the full syntax of the conditional is: ?x text1 | text2 . Which is interpreted as: if x is set construct ? use text1 else construct | use text2 fi construct . Although user−defined macros can be identified by an arbitrary capital letter, it is common to identify certain macros by the following letters: Macro Description B Bitnet relay C DECnet relay D The local domain — usually not needed E Reserved for X.400 relay F Fax relay H Mail hub for mail clusters L Luser relay M Masquerade who I claim to be R Relay for unqualified names S Smart host U My UUCP name if I have a UUCP connection V UUCP relay class V hosts v W UUCP relay class W hosts X UUCP relay class X hosts 473 Z Version number

20.2.1.1.2 The Define Class Command