${msg_id}

Value of the Message-Id: header V8.13 and later

The Message-Id: header (Message-ID: on page 1159) is used to uniquely identify each mail message. It must be declared in the configuration file. Its field must be an expression in the syntax of a legal email address (user@host) enclosed in angle brackets (< and >) composed of elements that create an identifier that is truly unique worldwide.

Beginning with V8.13, when sendmail finds a Message-Id: header in the current message, it assigns the value for that header to this ${msg_id} macro. If sendmail finds no Message-Id: header, it creates one and assigns that new value to this ${msg_id} macro.

If a Message-Id: header appeared in the original inbound message, its value can be made available to rule sets by using the H configuration command (Rules Check Header Contents on page 1130) and to Milters using an xxfi_header() routine (Milter xxfi_header() on page 1217). But if sendmail creates the Message-Id: header, its value can be made available only by using this ${msg_id} macro.

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

Get sendmail, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.