|
There are a number of good documents on the web (see the links on the right) that describe how to set up sendmail and other mail transfer agents on Linux machines. The problem is, most of them couch their level of description a little bit higher than a novice (such as I) finds useful, as they don't relate the logical actions of the MTAs to what actually happens on the machine at the file and directory level. These notes are an attempt to plug that gap. These notes are based on my knowledge of sendmail and fetchmail. Other MTAs might do things slightly differently, but I think that almost all of them follow the same conventions as sendmail. Preamble and DefinitionsFirst, a few definitions. There are three types of program that manipulate email: Mail User Agents (MUAs), which are used by people to read and compose emails; Mail Transfer Agents (MTAs), which move the emails from user to user and machine to machine; and Mail Delivery Agents (MDAs, also known as Local Delivery Agents, LDAs) which process mail just before it arrives at a user (for instance, doing spam filtering). Examples of MUAs are KMail, Evolution, Firebird, Outlook, and the Unix command-line There are also two types of mail servers around, each with their own communication protocol. Simple Mail Transfer Protocol (SMTP) is for sending email from one machine to another, and the machines on the receiving end of these transfers are called SMTP servers. Post Office Protocol version 3 (POP3) is used to talk to the machines (POP servers) that hold on to email until it can be transferred to the next machine that needs it. (There are other protocols used, such as IMAP, but their differences are irrelevant for this discussion.) (As a point of information, you should realise that email is not sent direct from your machine to the recipient's machine, but is passed in a series of hops from email server to email server, as and when, until it eventually arrives at its destination.) Most MUAs are able of communicating directly with your ISP's SMTP and POP servers, so many people get along just fine without using any MTAs on their own machine. But having an MTA has the advantage of convenience, particularly with a dialup connection: the MTA can queue messages sent from the MUA, so you haven't got to be online when you press the 'send' button in your mail client. You can also set up your machine to automatically dial up your POP server in the middle of the night and collect your email, so it's waiting for you in the morning. Also, you can use an MDA such as procmail to filter email, such as detecting viruses and spam. Note, however, that MDAs are only invoked on messages being delivered to a local user. Important Places
There are five important places to know about when it comes to the use of an MTA. The sending and receiving of email boils down to moving email messages (or rather, the files that contain the messages) between these places. It is the MTA that does the moving. The figure shows these places and how they are connected. Two of the places are owned by your ISP: the SMTP server, where all your outgoing email needs to end up; and the POP3 server, which holds your emails until you connect and collect them. Another place is where your MUA stores the emails it knows about. This is generally somewhere like The final two important places are owned by sendmail, and they are the message spool directories. A note on filesEmails reside in files. MUAs generally use either Messages in How it WorksNow we've got the structure, we can see how it works in practice. This is easier with an example. Let's say you've written an email in KMail, your MUA, and press 'send.' At this point your MUA give the message to sendmail and considers the email sent. Sendmail looks at the destination of the email; what it does next depends on where it's heading for.
That's great for sending mail, but how do you fetch mail from your ISP's POP server? That's where fetchmail comes in. Fetchmail is a single-minded beast. It does one thing, and one thing alone: it takes mail from a POP server, readdresses it to a local user, and places it in the This means that now, when sendmail examines the contents of What we haven't talked about is procmail. Procmail is used to pre-process email before it reaches the MUA. Generally, it is used to put email messages in places other than the And that's it. It isn't really that complicated, once you understand how all plumbing works. For a worked example of setting it all up, see the MTA setup and procmail setup sections in my Fedora Core 2 setup notes. |
More advanced and detailed information can be found at: |
This page maintained by Neil Smith (webmaster@wimp.freeuk.com)