Why does email need an envelope, and what does the "envelope" mean?
The envelope is used by the SMTP server and the message headers are used by a mail reader as everyone else has said.
What has not been said is that the RCPT TO:
is used to route the message to a specific user regardless of where the user's name appears in the headers. The user does not necessarily need to appear in the To:
or even the Cc:
headers. Think of a Bcc:
where the only thing that the receiver knows is who the message was from. In this case, the To:
and CC:
headers should be empty - hence the blind part of BCC. In another case, if an email message has the user mentioned in the CC list along with 10 other users, how can the SMTP routing pick the appropriate user. The answer is that it uses the RCPT
line to route the message.
This is also used when routing via mailing lists. The To: header will contain the mailing list e-mail address. An SMTP system will generate separate messages for each user in the list each with a specific RCPT TO: user@host...
envelope. In this case, the user's name will not even appear in any of the other headers.
The bottom line is that the overhead would be too great. When mail servers are processing millions of messages per day, it's much faster during the SMTP session (The Envelope) when the mail server can process individual commands.
If you didn't use an Envelope, you would have to push the entire message at the SMTP server, before you could find out if the message needs to be rejected. Some messages are quite large (I've seen 100+Meg messages working with GIS images).
By using an Envelope, we can issue specific 1 line commands against the mail server, and the mail server will tell us if we are successful or not, right then and there.
The recipient address in the SMTP RCPT TO:
command is what mail transports use to determine the actual recipient of an email. The addresses in the To: and Cc: headers are there for mail readers to display to users who the recipients are, but they're not actually used by mail transports.
Most mail clients set the same addresses in SMTP RCPT TO:
and MAIL FROM:
commands that they insert in To:, Cc:, and From: headers, so the "envelope" addresses will be the same as the addresses in the headers.
Envelope and header addresses will usually agree for most legitimate mail. Notable exceptions are Bcc: addresses and mailing lists.
Spammers often forge header addresses to try to avoid spam filters.