Appendix C: How Internet Mail Works

 < Free Open Study > 



Although internet mail is one of the most heavily used Internet services, many users—and a surprising percentage of system administrators—don't really understand how it works. This appendix provides some background about how Internet mail works and includes pointers to more detailed sources of information.

How a Message Gets from Point A to Point B

When a user on one host sends a message to a user on another host, many things happen behind the scenes of which you may not be aware.

Let's say Alice, alice@alpha.example.com, wants to send a message to Bob, bob@beta.example.com. Here's what happens:

  1. Alice composes the message with her mail user agent (MUA), something such as Mutt or Pine. She specifies the recipient in a To field, the subject of the message in a Subject field, and the text of the message itself. It looks something like this:

     To: bob@beta Subject: lunch How about pizza? 

  2. When she's satisfied with the message, she tells the MUA to send it.

  3. At this point, the MUA can add additional header fields such as Date and Message-Id and modify the values Alice entered (for example, it could replace bob@beta with Bob <bob@beta.example.com>).

  4. Next, the MUA injects the message into the mail system in one of two ways: It can run a program provided by the mail system for the purpose of injecting messages, or it can open a connection to the Simple Mail Transfer Protocol (SMTP) port on either the local system or a remote mail server. For this example, we'll assume the MUA uses a local injection program to pass messages to the MTA. The details of the injection process vary by MTA, but on Unix systems the sendmail program is a de facto standard. With this program, the MUA puts the header and body in a file, separated by a blank line, and passes the file to the sendmail program.

  5. If the injection succeeds—the message was syntactically correct and sendmail was invoked properly—the message is now the MTA's responsibility. Details vary greatly by MTA, but generally the MTA on alpha examines the header to determine where to send the message, opens an SMTP connection to beta, and forwards the message to the MTA on the beta system. The SMTP dialogue requires messages to be sent in two parts: the envelope, which specifies the recipient's address (bob@beta.example.com) and the return address (alice@alpha.example.com), and the message itself, which consists of the header and body.

  6. If the beta MTA rejects the message, perhaps because there's no user bob on the system, the MTA on alpha sends a bounce message to the return address, alice@alpha.example.com, to notify her of the problem.

  7. If the beta MTA accepts the message, it looks at the recipient's address, determines whether it's local to beta or on a remote system. In this case, it's local, so the MTA either delivers the message itself or passes it to a message delivery agent (MDA) like /bin/mail, qmail-local, or Procmail.

  8. If the delivery fails, perhaps because Bob has exceeded his mail quota, the beta MTA sends a bounce message to the envelope return address, alice@alpha.example.com.

  9. If the delivery succeeds, the message waits in Bob's mailbox until his MUA reads it and displays it.



 < Free Open Study > 



The Qmail Handbook
The qmail Handbook
ISBN: 1893115402
EAN: 2147483647
Year: 2001
Pages: 186
Authors: Dave Sill

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net