Next: Email Addresses Up: Electronic Mail Previous: What is a Mail

# How is Mail Delivered?

Generally, you will compose mail using a mailer interface like mail or mailx; or more sophisticated ones like elm, mush, or pine. These programs are called mail user agents, or MUA's for short. If you send a mail message, the interface program will in most cases hand it to another program for delivery. This is called the mail transport agent, or MTA. On some systems, there are different mail transport agents for local and remote delivery; on others, there is only one. The command for remote delivery is usually called rmail, the other is called lmail (if it exists).

Local delivery of mail is, of course, more than just appending the incoming message to the recipient's mailbox. Usually, the local MTA will understand aliasing (setting up local recipient addresses pointing to other addresses), and forwarding (redirecting a user's mail to some other destination). Also, messages that cannot be delivered must usually be bounced, that is, returned to the sender along with some error message.

For remote delivery, the transport software used depends on the nature of the link. If the mail must be delivered over a network using TCP/IP, SMTP is commonly used. SMTP stands for Simple Mail Transfer Protocol, and is defined in RFC-788 and RFC-821. SMTP usually connects to the recipient's machine directly, negotiating the message transfer with the remote side's SMTP daemon.

In UUCP networks, mail will usually not be delivered directly, but rather be forwarded to the destination host by a number of intermediate systems. To send a message over a UUCP link, the sending MTA will usually execute rmail on the forwarding system using uux, and feed it the message on standard input.

Since this is done for each message separately, it may produce a considerable work load on a major mail hub, as well as clutter the UUCP spool queues with hundreds of small files taking up an unproportional amount of disk space. Some MTAs therefore allow you to collect several messages for a remote system in a single batch file. The batch file contains the SMTP commands that the local host would normally issue if a direct SMTP connection was used. This is called BSMTP, or batched SMTP. The batch is then fed to the rsmtp or bsmtp program on the remote system, which will process the input as if a normal SMTP connection had occurred.

Next: Email Addresses Up: Electronic Mail Previous: What is a Mail