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.
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:
SENDMAIL and MAILTO:
The default sender is the first that exists of:
/F command-line option
MAILUSER environment variable
USERNAME environment variable
It defaults, in the absence of all of the above, to the name "os2user".
The default hostname is the first that exists of:
MAILHOST environment variable
HOSTNAME environment variable
It defaults, in the absence of all of the above, to the name ".".
The default domain name is obtained as per compatibility-mode name qualification in the DNS client library.
SMTPSD:
The default sender is empty.
The default hostname and the default domain are the value given in the
HELO/EHLO verb by the client.
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.
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:
Date:Message-ID:To: and
Cc:
To: header
containing an empty mailbox-group is added.
Path:,
NNTP-Posting-Host:,
NNTP-Posting-Date:,
XRef:, and
Newsgroups:
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:,
Sender: and
From:
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.
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.
All comments are stripped.
Muhammed.(I am the greatest)Ali@(the)Vegas.WBA
becomes
Muhammed.Ali@Vegas.WBA.
Missing angle brackets are added.
<c@a.test, joe@where.test, jdoe@one.test>
becomes
<c@a.test>, <joe@where.test>, <jdoe@one.test>.
Commas are inserted to separate multiple mailbox names.
<mary@x.test> <one@y.test>
becomes
<mary@x.test>, <one@y.test>.
Source routing is stripped.
<@example.org:mary@x.test>
becomes
<mary@x.test>.
Pseudo "bang paths" are stripped.
<mary@x.test@example.org>
becomes
<mary@x.test>.
Mailboxes without the @ symbol at all have that and the
default host name added.
<mary>, <joe>
becomes
<mary@default.host.name>, <joe@default.host.name>.
Mailboxes without domains have the default host name added.
<mary@>, <joe@>
becomes
<mary@default.host.name>, <joe@default.host.name>.
Mailboxes with single-label domains (and no trailing dot) have the
default domain name appended, as long as the default
domain name isn't a domain literal (such as [127.0.0.1]).
<mary@x>, <joe@y>, <fred@z.>
becomes
<mary@y.default.domain.name>, <joe@y.default.domain.name>, <fred@z>.