How SMTP messages are rewritten

The UCB sendmail compatibility utility, the SMTP Submission dæmon, and the Direct Submission utility all transform the submitted messages and envelopes that they receive to a canonical form before adding them to the maildrop.

Transformation parameters

The transformation involves three things, a default host name, a default domain name, and a default sender. The first two are components of an SMTP mailbox name. The third is a full mailbox specification. It can even name multiple mailboxes.

Each of the three programs obtains these items from slightly different places:

The default sender is subjected to the standard mailbox name canonicalizations before it is itself used.

The MAILHOST and MAILUSER environment variables are intended to be MTS-specific, to provide specific host and user names for use by the mail system that override the host and user names that are configured for general use by the system administrator or set by the login program. So whilst %USERNAME%@%HOSTNAME% may not be a valid mailbox name, %MAILUSER%@%MAILHOST% should be.

Things rewritten

Canonicalization transforms the envelope of the message (supplied on the command line for SENDMAIL and MAILTO, supplied via the SMTP conversation for SMTPSD) and the following headers in the message itself:

Content-Length:, Bcc:, Apparently-To:, and Return-Path:
These headers are discarded.
Date:
This header is added if not present.
Message-ID:
This header is added if not present, using the default hostname, the current time, and the process ID of the rewriting process. Message IDs in existing headers may omit their domain name portions, in which event canonicalization will append the default hostname to the ID. Message IDs will also have any SMTP comments stripped from them, and their bracketing "<" and ">" added if they are missing. Superfluous whitespace is also stripped, and the header re-folded.
To: and Cc:
These headers are subjected to the standard mailbox name canonicalizations. If neither is present, a dummy To: header containing an empty mailbox-group is added.
Path:, NNTP-Posting-Host:, NNTP-Posting-Date:, XRef:, and Newsgroups:
These headers are prefixed by X-Renamed- if SENDMAIL's /STRIPNEWSHEADERS option is enabled.
Reply-To:, Mail-Followup-To:, Mail-Reply-To:, Return-Receipt-To:, and Notice-Requested-Upon-Delivery-To:,
These headers are subjected to the standard mailbox name canonicalizations.
Sender: and From:
These headers are subjected to the standard mailbox name canonicalizations. If neither From: nor Sender: are supplied, then From: is added, using the value of the default sender. If From: is supplied but contains more than one mailbox, and Sender: is not supplied, Sender: is added, using the value of the default sender.

Mailbox canonicalizations

The standard mailbox canonicalizations are applied to all mailboxes listed in the envelope, to the default sender, and to mailboxes listed in the headers noted above. They use the default host name and the default domain name.


The Internet Utilities are © Copyright Jonathan de Boyne Pollard. "Moral" rights are asserted.