Electronic Mail Overview
There are three components to electronic mail:
- MAIL USER AGENT - e.g. mailx, elm. dtmail, pine
- MAIL TRANSFER AGENT - e.g. sendmail
- MAIL DELIVERY AGENT - e.g. SMTP, local mailer, UUCP
MAILBOX - a file on a mail server to store mail, typically in /var/mail
MAIL HOST - main mail computer, mail is sent here when the other mail computer can't deliver it MAIL SERVER - maintains mailboxes CLIENT - receives mail, usuall no local /var/mail The mail directory (e.g. /var/mail), can be NFS mounted if the mail server isn't the users local box. This saves having numerous mail servers.
/bin/mailx user sends mail | | V sendmail messages routed | | V local mailer delivers to mailbox | | V mailx message read
Sendmail parses the message and using the rules in sendmail.cf, works out where to send it. It acts as an interface between mail user agent and mail transport agent, e.g. SMTP . It also supports forwarding mechanisms e.g. aliases, .forward file.
Mail is sent via the mail gateway. For mail sent over the internet, sendmail typically starts a SMTP session with the remote sendmail daemon. Usually, rather then deliver to the actual destination (which could be a PC over a modem line, probably not active), it delivers to the mail exchange server.
During the transfer a DNS lookup is triggered. This finds the mail exchange for the domain from the MX record (trying the one with the highest priority first). From there, the user can recover the mail using POP3 (which periodically and/or on demand, downloads the mail) or IMAP which lists the mail on the mail exchange.