Adapted from a posting to the Procmail
mailing list by Alan Stebbens Fri, 09 Aug 1996 13:19:52 -0700
To help clarify E-mail headers, here's a diagram of the E-mail
process and its several steps:
sender -> MUA -> MTA -> (routing) -> MTA -> MDA -> {filtering} -> MUA -> receiver
[1] [2] [3] [4] [5] [6]
- MUA
- Mail User Agent -- The program run by the user to
read, reply to, compose and dispose of electronic
mail (E-mail) messages. The MUA provides the
interface between the user and the Message Transport
Agent (MTA). Outgoing mail is handed over to an MTA
for delivery while the incoming messages are picked
up from a Mail Delivery Agent (MDA). Example of MUAs
include the original UNIX mail program, /bin/mail,
the Berkely Mail program and it's System V equivalent
mailx, software programs like mush, elm,
mutt,
mh,
Pine, Pegasus, and
commerical programs like Eudora.
- MTA
- Mail Transport Agent or Message Transfer Agent -- The
program responsible for storing and forwarding or
delivering E-mail messages. Upon receiving a message
from an MUA or another MTA it stores it locally and
temporarily for analysis of the recipients and either
delivers it to a local addressee or forwards it to
another MTA. In either case it may edit and/or add to
the message headers. It is usually referred to as the
"mail server program." An example of this
is UNIX sendmail
or others including mmdf,
smail,
ZMailer,
Exim, and Microsoft
Exchange Server.
- MDA
- Mail Delivery Agent -- the actual program responsible
for delivering mail to a user. MDAs usually handle
one specific type of mail delivery. On UNIX systems
this is typically the program /bin/mail, which
is responsible for placing E-mail into a user's local
mailbox file. Other MDAs include: uux for
delivering UUCP mail; Procmail
for advanced filtering of mail before delivery or maildrop
which reads a mail message from standard input, then
delivers the message to your mailbox.
Headers typically are provided by a "template"
from the MUA to the sender when composing E-mail, usually
during step [1]: See RFC2822
From: # who is the sender
To: # who gets this mail
Cc: # people to keep informed, but need not respond
Bcc: # other people to keep informed, keep secret
Subject: # what the mail is about
Reply-To: # added by originator to direct replies
Priority: # try to influence speed and delivery
Precedence: # set ordering in queue
Resent-To: # used for redirecting (forwarding) E-mail
Resent-Cc: # ditto
X-[something]: # personalized headers
When the sender is done composing, and says "send it"
to their mailer, some additional headers may get inserted by
the MUA at step [2]: See RFC2045 for
MIME (Multipurpose Internet
Mail Extensions).
Date: # day month year or dd mm yy hh:mm:ss zzz
Resent-Date: # if being redirected (forwarded)
From: # actual submittor
Sender: # if a From: is already present
X-Mailer: # what MUA composed this message
Mime-Version: # if using a MIME capable mail program
Content-Type: # type and subtype of data in message
Content-Transfer-Encoding: # describe data type in message
When the MTA receives the E-mail from the MUA at step [3],
it may insert additional headers showing the origination of
the E-mail:
From # if local E-mail, automatic or by filter options
Date # if not already present
Message-Id: # unique ID for the E-mail; the first MTA creates this
Received: # trace routing of mail
Return-Path: # shows how to get back to the sender
As each MTA hands off the E-mail, additional headers may
get added, all as part of the MTA to >MTA hand-off in step
[3]:
Received: # inserted by each MTA for each message relay
As the final MTA hands the E-mail to a MDA, in step [4],
there are still some more header insertions which may occur:
Apparently-To: # added if no To: header exists
From # may get added if local E-mail
Some sites insert special rewrite rules and mail filtering
to occur to support virtual domains, and these header changes
will occur at step [5], just before the incoming mail is
dropped. Generally though, no new headers are added, except
possibly by procmail to avoid loops, sort e-mail or auto-respond
to a sender's e-mail request:
X-Loop: # inserted to avoid filtering loops
Finally, at step [6] when the reader views their E-mail,
most MUAs will apply a filter to the stored mail causing
selected headers to be omitted from the display. In a sense
then, this filtering "removes" the headers from the
user's view (although no headers are actually removed by the
MUA).
Example from Eudora before full header display:
Reply-To: "Somebody"
From: "Somebody"
To:
Subject: Test message
Date: Fri, 2 Mar 2001 12:04:31 -0800
Organization: SomeOrganiztion
X-Mailer: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
Test message!!
The headers typically omitted are those inserted by the
MTAs, and those having to do with the transport process and
less with the contents.
Example from Eudora after full header display:
Received: from hawk.prod.itd.earthlink.net (hawk.prod.itd.earthlink.net [207.217.120.22])
by no2.superb.net (8.11.1/8.11.1) with ESMTP id f22K5xv12202
for ; Fri, 2 Mar 2001 15:05:59 -0500 (EST)
Received: from pacer2 (hsa184.pool015.at101.earthlink.net [216.249.86.184])
by hawk.prod.itd.earthlink.net (EL-8_9_3_3/8.9.3) with SMTP id MAA14914
for ; Fri, 2 Mar 2001 12:05:58 -0800 (PST)
Message-ID: <001301c0a353$feb287e0$a64cfea9@pacer2>
Reply-To: "Somebody"
From: "Somebody"
To:
Subject: Test message
Date: Fri, 2 Mar 2001 12:04:31 -0800
Organization: SomeOrganiztion
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
Status: RO
Test message!!