27

Just out of curiosity, there are dozens / hundreds of tutorials helping you setup a dovecot - postfix mail server. On the surface, both of them are email servers, why use both? Mail servers are complicated enough, why have 2 things to manage and troubleshoot?

Makes about as much sense on the surface as running CentOS inside Ubuntu and always wondering why ./configure is confused :)

http://www.dovecot.org/

Dovecot is an open source IMAP and POP3 email server for Linux/UNIX-like systems, written with security primarily in mind. Dovecot is an excellent choice for both small and large installations. It's fast, simple to set up, requires no special administration and it uses very little memory.

http://www.postfix.org/

What is Postfix? It is Wietse Venema's mail server that started life at IBM research as an alternative to the widely-used Sendmail program. Now at Google, Wietse continues to support Postfix.

I followed one of those many guides and got it all working with TLS authentication to Postfix and ISPConfig, then realized at the end that I really never had to touch Dovecot, but wasn't sure if it had to be there for the spam filters, antivirus or some other thing I am not thinking of.

2 Answers 2

41

Postfix and Dovecot do different things.

Postfix is an MTA, or Mail Transfer Agent.

It accepts mail from the outside world and from local sources, and routes it to its destination. This may involve an smtp connection to another machine, or it may involve delivering it to a local delivery agent or writing it directly to an mbox. When an MTA goes wrong, things get ugly; your machine may be used to bounce huge amounts of spam, for instance.

However, because of the way that our email system works, an MTA has to interact constantly with both legitimate and unwanted mail sources.

Dovecot is mailbox interface software.

Specifically, it allows users to access their mailboxes using the IMAP interface. If configured correctly, it only interacts with authenticated users. This means that in general, dovecot doesn't have to "talk to the bad guys."

The view from 50,000 feet: Postfix "knows about" SMTP. Dovecot "knows about" IMAP.

(Yes, Postfix can use Dovecot to perform authentication, and Dovecot’s LDA to put mail in mboxes, so there's definitely more to the story.)

0
-1

Postfix just concerns itself with sending off client emails and temporarily storing incoming emails without sorting them according to recipient email address.

Dovecote's principal task is sorting the emails received by the mail transfer agent (MTA), e.g. Postfix, and delivering them on demand by each recipient. It separates the mass of emails arriving to Postfix's single mailbox into individual mail boxes for each recipient address and simultaneously listens for requests for new email from recipients' email client packages, e.g. Outlook or Thunderbird.

The reason Linux systems have this separation of responsibilities may be related to the historical development of both Unix and email. The early adopters of email - and this was before the internet - were large organizations with existing (and labor intensive) internal post systems. Yes, universities and government departments used to have their own post rooms, postmen and delivery cycles up to the 1980s at least.

MTAs of the 1980s could effect immediate email delivery when operating on a local network that each client was always connected to: there was no need to store undelivered emails for later delivery - they were transferred to the recipient's email Inbox in his/her user's filespace. That was also in the days of Unix being an op system for mainframe servers to individual users' terminals. As soon as a user logged into a terminal of the organization's mainframe, they saw a new mail message on their monitor.

With PCs getting more powerful and remote network connecting of info systems becoming possible, there began an evolution of email into a means of communication between people separated by long distances. Network connections then were via phone lines so they could not afford to remain switched on at all times. Hence the need to store emails undeliverable at an arbitrary time owing to the likely absence of a recipient from their workstation. Thus happened the birth of dedicated web/email/data/application server machines that were always connected to an external network and client machines (i.e. desktops and laptops) that only connected externally on occasions they needed data from a server.

In the meantime Unix had morphed from a mainframe op system feeding terminals from a server to an integrated standalone op system for PCs - although Unix was usually an alternative op sys to MS-DOS/Windows, Mac OS, OS1, OS2. Yet Unix's inherent serving capabilities made it a good choice for web server machines. The early 1990s saw the entry of a free open source op system, Linux, that was modelled on Unix. Linux soon became the preferred op system in web server machines as many people contributed kernel and application code to it and since it cost nothing; it was eventually felt to be even a better op system than Unix.

The Sendmail MTA is around since 1983 when it replaced the Delivermail package used by the ARPANET to communicate between various parts of the US Dept of Defense. With widening consumer use of email after the internet became available, people started using different email addresses for work, home and leisure arenas. All this led to a need by PC users to deliver from the server separately all emails to all their addresses - a mail delivery agent (MDA) package. Sendmail remained focused on improving transfer of email on Unix and Unix's free displacer op system, Linux servers. To create an integrated transfer/delivery mail agent would take a huge amount of time from the open source community that had already provided Sendmail and then its superseder, Postfix. It made much more sense to simply write a basic mail delivery agent that bolted on to proven MTAs like Sendmail or Postfix. And that's what happened. Dovecot and other MDAs were developed to work with existing MTAs and their output directories' contents became the input for the MDA.

While many of us trying to configure mail on a VPS might find it gauche to be dealing with both an MTA and an MDA plus various other things to enable spam filtering, web mail access, etc, we have to recall that we are getting so much for free in all this. That some compromises need to be made for the sake of easier development or more reliable mail service is something that we ought to manfully accept sometimes.

Unless you want us all to go back to Microsoft Exchange Server and Outlook . . . Anyway just look inside MS Exchange Server and you will doubtless see separate modules for mail transfer, mail proxying, spam elimination, delivery and so on. The principles of building a good software system won't change when you choose a new supplier: separation of concerns enables simultaneous development of various packages within the system as long as their interfaces remain fixed; it also allows for easier bug tracking.

At least with Linux you can choose different individual or combinations of mail server packages depending on your needs and preferences. Then you can immediately "go configure" each of the component packages.

8
  • -1: How does this improve upon the other answer posted here from 4 years back? This reads like a long, rambling blog post. Sep 30 at 18:44
  • I'm not sure where to start here. UUCP was the early frontrunner to having only intermittent access to other email systems. The server PC's you refer to sounds like an oxymoron - a server personal computer? Institutional servers tended to be servers, not PCs. Next UNIX was developed on a mini-computer (PDP-7), use on mainframes happened long after its adoption on minis. UNIX on the desktop prior to various version of BSD in the mid-90's was mostly restricted to specialized systems, AT&T 3B2, Sun and DEC workstations, etc. and these tended to be expensive. x86 was not supported other than V7.
    – doneal24
    Sep 30 at 18:50
  • Postfix certainly sorts emails by recipient. Putting in /var/spool/mail/user is sorting. Dovecot then pulls the emails out of those files. How are you expecting postfix to store emails other than by recipient?
    – doneal24
    Sep 30 at 18:52
  • @Giacomo 1968 On the surface, both of them are email servers, why use both? The previous answer distinguished between Postfix and Dovecot. It made no attempt to say why both packages were used rather than a single one.
    – Trunk
    Oct 1 at 9:54
  • @donedeal24 I was using the term PC to distinguish these systems from mainframe terminals used previously. I will change it to server machine and local machine to assuage your sensitivity to oxymoron. Yes, Unix was used on PDP clusters and later networked Wangs, etc. No, Unix was offered by many IBM clone PC builders from 1992 - I know this as my local builder in Nottingham, UK did so and I saw other builders also offering it. Maybe it wasn't standard for IBM, Compaq, HP, etc. I don't know as I couldn't afford to consider them then. When I say sort emails, I mean by address not user.
    – Trunk
    Oct 1 at 10:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.