21.4 Macro Names

Prior to V8.7 sendmail, macros could have only single characters as names. Beginning with V8.7, macros can be single-character or multicharacter.

21.4.1 Single-Character Names

Prior to V8.7 sendmail the name of a macro was required to be a single character.[5] Any character can be used except the { character. However, sendmail uses many characters internally and requires that they serve specific purposes. In general, only uppercase letters should be employed as user-defined macro names. Arbitrary use of other characters can lead to unexpected results.

[5] Beginning with V8.7, both single- and multicharacter names can be used.

The character that is the macro's name must be a single-byte character. Multibyte international characters have only the first byte (or last, depending on the machine architecture) used for the macro's name, and what remains is joined to the text.

The high (most significant) bit of the character is always cleared (set to zero) by sendmail.

21.4.2 Multicharacter Names

Beginning with V8.7, macro names can be multicharacter. A multicharacter macro name must always appear inside a curly brace pair.[6] For example:

[6] As an artifact of this scheme, a single character surrounded in curly braces is treated as if the curly braces were absent:


Here, name is one or more characters that form the macro name. If there are no characters between the curly braces, sendmail prints the following error and names the macro "{ }":

configfile: line num: Name required for macro/class 

A multicharacter macro name can contain only letters, digits, and the underscore character. Each bad character between the curly braces (including spaces) will produce the following error and cause that character to be ignored:

configfile: line num: Invalid macro/class character badchar  

In general, your macro names should always begin with an uppercase character. Macro names that begin with lowercase characters are reserved for internal use by sendmail.

If the left curly brace is missing but the right is present, the macro name becomes the first letter following the D and the rest becomes the text:

Dname}text    sets $n to ame}text

If the right curly brace is missing but the left is present, the following error is printed, and the macro is not defined:

configfile: line num: Unbalanced { on nametext 

For V8.10 and above, the maximum length of a macro name is hardcoded at 25 characters.[7] This cannot be changed with compile-time definitions. If you declare a macro name that (not counting the curly braces) is longer than 25 characters, the following error will be printed and the excess characters will become the value of an undefined name:

[7] Prior to V8.10 the maximum length was hardcoded at 20 characters.

configfile: line num: Macro/class name ({AReallyVeryLongMacroNameHere}) too long (25 
chars max) 

Because of the way multicharacter names are encoded into a single byte, there is a fixed limit on the number of multicharacter macro names that you can declare. That limit includes those multicharacter names internally defined by sendmail,[8] and those declared for class macros. There can be, at most, 96 multicharacter macro names. If you try to declare a 97th name, the following error will print and that definition will be ignored:

[8] One for V8.7 and many for V8.8 and above.

Macro/class {name}: too many long names

    Part I: Build and Install
    Part II: Administration
    Part III: The Configuration File
    Chapter 21. The D (Define a Macro) Configuration Command
    Chapter 24. The O (Options) Configuration Command