The relationship between the MTA, Sendmail, Procmail etc.

Q I am just trying to work out the whole Linux mail server scenario. I understand that the mail transfer agent (MTA) is a program such as Sendmail or Postfix that actually does the SMTP sending, receiving and so on. I also understand the obvious mail user agent examples such as Evolution. I am trying to understand exactly what a mail delivery agent like Procmail does. Do I need to have one installed on my system?

A When someone sends a mail to your server that is addressed to you, the MTA handles accepting the connection from the remote server and receiving the mail. It also handles the opposite transaction: when you send a mail through it, it finds the next server in the chain and passes the mail to that. Once the MTA has received the mail, it has to deliver it, usually into your mailbox. Most MTAs can do this themselves, especially if it is a simple case of adding the mail to a local user's mailbox, but it is more common to use a separate mail delivery agent (MDA) to take care of this.

So an MDA is not absolutely necessary, but it is usually desirable, for a number of reasons. An MDA like Procmail adds a lot more options - mails can be processed before delivery, for example, to strip annoyingly huge mailing-list footers from them, or filtered into separate mailboxes. Procmail can also handle things like vacation messages (do those after you've filtered for mailing lists, or you will get yourself kicked off a few lists when you go on holiday). All this can be done before the mail is delivered to the user. Another reason for using something like Procmail is that, in addition to any global rules in /etc/procmailrc, each user can set up processing or filtering rules in .procmailrc in their home directory. On a multi-user system, this gives each user individual control over their mail delivery.

If they want copies of their mail forwarded to their Gmail account while they are away, a simple rule will cover it. It is also possible to have the MTA pass the mail to a program other than an MDA, like a virus scanner or spam filter. These then pass the message to the MDA for delivery (or not) after doing their job. So the mail could go from MTA to spam filter to virus scanner to MDA and then into the user's mailbox. Collecting or reading your mail via POP3 or IMAP requires another program, which reads the mail from the mailbox where it was placed by the MDA.

Follow us on or Twitter

Username:   Password:
Create Account | About TuxRadar