Unix Network Admin   «Prev  Next»
Lesson 2Electronic mail and sendmail
ObjectiveExplain the email process and the use of agents.

Electronic mail and sendmail

Electronic mail is a system for sending messages between individuals specified by electronic mail addresses. The principal problem that the electronic mail system needs to solve is that of routing a message from the sender to the intended recipient.
This problem can be subdivided into several stages:
  1. The sender of the message composes the message and dispatches it for delivery.
  2. The message is routed from machine to machine across the Internet until it reaches the destination host, where the intended recipient has an account.
  3. The message arrives at the destination host and is delivered to a mailbox file owned by the intended recipient.
  4. The intended recipient accesses their mailbox file and reads the new message.
A different program handles each of these steps. These programs are also called agents.

Email and sendmail

A mail user agent (MUA) is any of the many programs that users run
  1. to read,
  2. reply to,
  3. compose, and
  4. dispose of email.
Examples of an MUA include the original Unix mail program (/bin/mail); the Berkeley Mail program; its System V equivalent (mailx); free software programs such as mush, elm, pine, and mh; and commercial programs such as Zmail. Examples of MUAs also exist for PCs. Eudora and Claris- Works are two standalone MUAs. Netscape and Explorer are web browsers that can also act as MUAs. Thunderbird is an open source MUA from the folks at Mozilla. Many MUAs can exist on a single machine. MUAs sometimes perform limited mail transport, but this is usually a very complex task for which they are not suited.
A mail transfer agent (MTA) is a specialized program that delivers mail and transports it between machines, like the post office does. Usually, there is only one MTA on a machine. The sendmail program is an MTA.
Beginning with V8.10, sendmail also recognizes the role of a mail submission agent (MSA), as defined in RFC2476. MTAs are not supposed to alter an email's text, except to add Received:, Return-Path:, and other required headers. Email submitted by an MUA might require more modification than is legal for an MTA to perform, so the new role of an MSA was created. An MSA accepts messages from an MUA, and has the legal right to heavily add to, subtract from, and screen or alter all such email.
An MSA, for example, can ensure that all hostnames are fully qualified, and that headers, such as Date:, are always included.

Linux System Administration

Agents

Steps 1 and 4 of the process above are handled by a Mail User Agent (MUA). Examples of Mail User Agents are pine, elm, and the UNIX mail program. Step 2 of the above process (from the moment when the message is dispatched for delivery by the MUA until it arrives at the destination machine) is handled by a program called a Mail Transfer Agent (MTA). MTA’s route email among different machines. On the Internet today, this machine-to-machine routing of email nearly always employs the application layer protocol called Simple Mail Transfer Protocol, or SMTP, on top of a TCP connection. Step 3 of the above process is handled by a Mail Delivery Agent (or MDA). The Mail Delivery Agent copies the message from the MTA into the user’s mailbox file. Examples of MDAs include the procmail program and the UNIX mail program.
Under some circumstances, a single program may carry out more than one of the above functions. For example, the UNIX mail program may function as both an MUA and an MDA for mail sent to users on the local host.