If you are building a Linux mail server, two names come up again and again: Postfix and Dovecot.
They are often used together, but they do different jobs.
That point confuses a lot of people at first. Someone installs Postfix and expects it to handle everything. Someone else installs Dovecot and wonders why mail is not sending. The truth is that a working mail system usually needs both pieces, because sending mail and reading mail are not the same thing.
Postfix is mainly the mail transfer system. It handles the movement of mail between servers and from applications to the outside world.
Dovecot is mainly the mail access system. It lets users connect to their mailbox, read messages, and authenticate.
When you put them together correctly, you get a strong base for a self-hosted email system.
This guide explains how Postfix and Dovecot fit together, what each one does, how mail flows through the system, and where small businesses and Linux administrators often get confused.
Quick Answer
Postfix and Dovecot are usually used together because they solve different parts of the email problem.
- Postfix handles sending, receiving, and routing mail
- Dovecot handles mailbox access, IMAP, POP3, and user authentication
A simple way to think about it is this:
- Postfix moves mail
- Dovecot helps users open and manage mail
If you are designing a Linux mail server, Postfix is usually the part that talks to other mail servers, while Dovecot is the part that talks to mail clients like Outlook, Thunderbird, Apple Mail, or webmail.
What Is Postfix?
Postfix is a Mail Transfer Agent, often shortened to MTA.
An MTA is the part of a mail server that handles the movement of email.
Postfix is commonly responsible for:
- receiving incoming mail from the internet
- sending outgoing mail to other servers
- accepting mail from local applications
- routing messages to the right destination
- managing the mail queue
- retrying delivery if the first attempt fails
If your server accepts mail for yourdomain.com, Postfix is usually the part listening on SMTP ports and deciding what to do with each message.
In simple terms
Postfix is like the mail shipping department.
It does not act like a user inbox. It does not show your messages in a pretty interface. Its job is to move mail from one place to another safely and correctly.
What Is Dovecot?
Dovecot is a mail delivery and access server that is commonly used for:
- IMAP
- POP3
- mailbox access
- user authentication
- mail storage access
Dovecot is usually the part that lets users do things like:
- log in to their mailbox
- read messages in an email app
- organize folders
- move mail between folders
- download or sync mail
Dovecot can also help with authentication for SMTP submission, which means it often works closely with Postfix even when a user is sending mail.
In simple terms
Dovecot is like the mailroom and front desk.
It helps users get into their mailbox, find their messages, and prove who they are.
Why Postfix and Dovecot Are Used Together
A complete mail system usually needs both mail transport and mail access.
That is why these two are often paired.
Postfix handles:
- mail coming in
- mail going out
- server-to-server delivery
- queueing and routing
Dovecot handles:
- user login
- mailbox access
- IMAP and POP3 connections
- reading and organizing stored mail
If you only have Postfix, users may not have a good way to log in and read their mail.
If you only have Dovecot, the server may not know how to accept and route mail from the outside world.
Together, they create a usable mail system.
The Basic Mail Flow
A lot of confusion disappears once you understand the path a message takes.
Here is a simple version of the flow.
Incoming mail flow
- Another mail server sends a message to your domain
- Postfix receives that message over SMTP
- Postfix decides whether the message should be accepted
- Postfix passes the message to local delivery
- The message is stored in the user’s mailbox
- Dovecot lets the user connect and read it through IMAP or POP3
Outgoing mail flow
- A user connects from a mail client or webmail
- The user authenticates
- The message is submitted to Postfix
- Postfix queues and routes the message
- Postfix connects to the remote destination mail server
- The message is delivered
In many setups, Dovecot helps confirm the user’s login, while Postfix handles the actual sending.
What Postfix Does in More Detail
Postfix is not just “the SMTP server.” It has several important responsibilities.
1. Accepting incoming SMTP mail
When another server wants to deliver mail to your domain, it usually connects to Postfix on port 25.
Postfix then checks things like:
- is this domain hosted here
- is the message allowed
- is the sender suspicious
- should restrictions apply
- should the mail be queued or rejected
2. Sending outgoing SMTP mail
When your server needs to send mail out to the internet, Postfix handles that too.
It looks up the destination domain’s MX records and tries to deliver the message to the right remote server.
3. Managing the queue
Not every message can be delivered right away.
If a remote server is unavailable, busy, or rejecting mail temporarily, Postfix can hold the message in a queue and retry later.
This is one of the most important parts of a real mail system.
4. Applying rules and restrictions
Postfix can enforce rules such as:
- who is allowed to send mail
- which domains are local
- relay restrictions
- SMTP authentication requirements
- TLS requirements
- recipient checks
5. Passing mail to local delivery
Postfix does not normally act as the mailbox reader for users. After it accepts mail, it usually hands the message off so it can be stored properly in the user’s mailbox.
What Dovecot Does in More Detail
Dovecot is more focused on the user side of the mail system.
1. IMAP access
IMAP lets users read and manage mail while keeping the main copy on the server.
This is what many modern business email users expect.
With IMAP, users can:
- sync across devices
- keep folders on the server
- see the same mailbox from phone, desktop, and webmail
2. POP3 access
POP3 is older and simpler. It is still supported in some setups, but IMAP is usually the more common choice now.
3. Mailbox access and storage handling
Dovecot knows how to work with mailbox formats and give users safe access to their stored messages.
4. User authentication
Dovecot often handles mailbox logins and can also provide authentication services to Postfix.
That means when a user sends mail through authenticated SMTP submission, Dovecot may be the system verifying the username and password.
5. Folder and mailbox management
Dovecot helps users interact with mail folders and mailbox structure in a consistent way.
A Simple Architecture View
A basic Postfix and Dovecot setup often looks like this:
- DNS
- MX records point mail to your server
- Postfix
- receives and sends mail over SMTP
- Mailbox storage
- stores user messages
- Dovecot
- lets users log in and read mail
- Webmail or mail client
- gives users an interface
You may also add other pieces such as:
- spam filtering
- virus scanning
- DKIM signing
- TLS certificates
- fail2ban
- monitoring
- backups
But the core idea stays the same:
Postfix moves mail, Dovecot serves mailboxes.
Common Ports in a Postfix and Dovecot Setup
These ports often come up in a real deployment.
Postfix-related ports
- 25 for SMTP server-to-server mail
- 587 for authenticated mail submission
- sometimes 465 for SMTPS depending on setup
Dovecot-related ports
- 143 for IMAP
- 993 for IMAPS
- 110 for POP3
- 995 for POP3S
A common source of problems is opening the wrong ports or forgetting to secure them properly.
How Authentication Often Works
Authentication is one of the places where Postfix and Dovecot overlap.
A common setup looks like this:
- a user connects to submit mail on port 587
- Postfix accepts the connection
- Postfix asks Dovecot to verify the username and password
- Dovecot confirms whether the login is valid
- Postfix allows the user to send mail if authentication succeeds
This is a good example of the two systems working together without doing the same job.
Postfix handles the mail submission.
Dovecot helps verify the user.
Mail Storage and Mailbox Formats
Under the surface, a mail server needs to decide how messages are stored.
Two common mailbox styles are:
- mbox
- Maildir
Many modern setups prefer Maildir because it stores each message as a separate file, which can be easier to manage and more reliable in some environments.
Dovecot works well with mailbox storage and is often the piece most closely tied to how mail is read from disk.
This matters because mailbox format affects:
- performance
- reliability
- backup behavior
- migration work
- troubleshooting
Common Mistakes in Postfix and Dovecot Setups
1. Thinking one of them replaces the other
This is the biggest beginner mistake.
Postfix and Dovecot are not competing tools. They are usually partners in the same system.
2. Forgetting that DNS matters
Even a perfect Postfix and Dovecot setup can fail badly if DNS is wrong.
You still need to think about:
- MX records
- A and AAAA records
- PTR / reverse DNS
- SPF
- DKIM
- DMARC
3. Poor authentication design
If submission and mailbox authentication are not set up clearly, users may be able to receive mail but fail to send it.
4. Opening too many ports
A mail server should expose what it needs, but not more.
5. Ignoring TLS
Modern mail systems should use TLS for mailbox access and authenticated submission.
6. Underestimating deliverability
A server may work technically but still have poor delivery because of IP reputation, DNS mistakes, missing reverse DNS, or weak mail authentication.
What a Small Business Needs to Know
For a small business, the technical details matter less than the operational reality.
A Postfix and Dovecot system can be very good if:
- it is designed correctly
- DNS is clean
- TLS is in place
- spam controls are added
- backups are working
- someone actually monitors it
But it is not a “set it and forget it” system.
If a business decides to self-host email, it should understand that it is taking on:
- maintenance
- updates
- monitoring
- deliverability work
- troubleshooting
- security responsibility
That does not mean it is a bad choice. It means it should be an informed one.
Example Scenario
Imagine a small company with the domain example.com.
Their DNS has MX records pointing to a Linux mail server.
Here is what happens:
- another server sends mail to
employee@example.com - Postfix receives the message
- Postfix accepts it as local mail for the domain
- the message is stored in the mailbox
- the employee opens Outlook or Thunderbird
- Dovecot provides IMAP access to the mailbox
- the employee reads the message
Then the employee replies:
- the mail client connects to the submission service
- the employee logs in
- Dovecot helps verify the login
- Postfix accepts the outgoing message
- Postfix sends it to the recipient’s mail server
That is the architecture in action.
Best Practices
If you are planning a Postfix and Dovecot setup, keep these best practices in mind:
- understand clearly which service does what
- use Postfix for transport and Dovecot for access
- secure submission and mailbox access with TLS
- use proper SMTP authentication
- choose a mailbox format intentionally
- keep DNS records correct
- monitor queues, storage, and service health
- back up mailbox data
- do not treat mail as a casual side service
Frequently Asked Questions
Does Postfix store email?
Postfix can handle delivery and transport, but mailbox access and storage handling are usually tied more closely to Dovecot and the local mailbox setup.
Does Dovecot send mail?
Not usually in the main transport sense. Dovecot handles mailbox access and authentication. Postfix usually handles sending and receiving over SMTP.
Do I need both Postfix and Dovecot?
In most self-hosted business mail systems, yes. Postfix handles transport and Dovecot handles mailbox access.
What is easier to understand first?
Start with the basic job split:
Postfix moves mail.
Dovecot lets users access mail.
Is Postfix and Dovecot a full business mail solution by itself?
Not completely. You still need DNS, TLS, spam filtering, backups, monitoring, and good security practices.
Final Thoughts
Postfix and Dovecot are often used together because they handle different parts of the same system.
Postfix is the engine that moves email from place to place.
Dovecot is the service that lets users log in and work with their mailboxes.
If you understand that division clearly, the overall architecture becomes much easier to follow.
For small businesses and Linux administrators, this is an important starting point. A self-hosted mail server is not just one package. It is a group of services working together. Postfix and Dovecot are two of the most important pieces in that design.
When they are configured properly and supported by strong DNS, security, and monitoring, they can form the base of a reliable mail platform.
