Next: Emacs Speaks SMTP, Previous: Top, Up: Top

## 1 How Mail Works

On the internet, mail is sent from mail host to mail host using the simple mail transfer protocol (SMTP). To send and receive mail, you must get it from and send it to a mail host. Every mail host runs a mail transfer agent (MTA) such as Exim that accepts mails and passes them on. The communication between a mail host and other clients does not necessarily involve SMTP, however. Here is short overview of what is involved.

The mail program — also called a mail user agent (MUA) — usually sends outgoing mail to a mail host. When your computer is permanently connected to the internet, it might even be a mail host itself. In this case, the MUA will pipe mail to the `/usr/lib/sendmail` application. It will take care of your mail and pass it on to the next mail host.

When you are only connected to the internet from time to time, your internet service provider (ISP) has probably told you which mail host to use. You must configure your MUA to use that mail host. Since you are reading this manual, you probably want to configure Emacs to use SMTP to send mail to that mail host. More on that in the next section.

Things are different when reading mail. The mail host responsible for your mail keeps it in a file somewhere. The messages get into the file by way of a mail delivery agent (MDA) such as procmail. These delivery agents often allow you to filter and munge your mails before you get to see it. When your computer is that mail host, this file is called a spool, and sometimes located in the directory `/var/spool/mail/`. All your MUA has to do is read mail from the spool, then.

When your computer is not always connected to the internet, you must get the mail from the remote mail host using a protocol such as POP3 or IMAP. POP3 essentially downloads all your mail from the mail host to your computer. The mail is stored in some file on your computer, and again, all your MUA has to do is read mail from the spool.

When you read mail from various machines, downloading mail from the mail host to your current machine is not convenient. In that case, you will probably want to use the IMAP protocol. Your mail is kept on the mail host, and you can read it while you are connected via IMAP to the mail host.

So how does reading mail via the web work, you ask. In that case, the web interface just allows you to remote-control a MUA on the web host. Whether the web host is also a mail host, and how all the pieces interact is completely irrelevant. You usually cannot use Emacs to read mail via the web, unless you use software that parses the ever-changing HTML of the web interface.