Dovecot is an open-source mail server that gives users access to their stored mailboxes over IMAP and POP3, and that can also deliver incoming messages into those mailboxes through its LMTP service and local delivery agent. In email infrastructure it occupies the mailbox side of the system: a mail transfer agent such as Postfix or Exim moves messages between domains, while Dovecot stores them, indexes them and serves them to email clients.
Dovecot is one of the most widely deployed IMAP servers on the Internet, used by hosting providers, universities, internet service providers and single-domain administrators. Its reputation rests on index-based performance, a security-conscious process design and a flexible authentication subsystem that other components, including Postfix, can reuse for SMTP authentication.
How Dovecot is structured internally
Dovecot runs as a master process that starts and supervises a set of specialized services, each with minimal privileges. Network-facing login processes handle the unauthenticated phase of a connection, including TLS negotiation, and only after successful authentication does the master hand the connection to a mail process that runs as the user who owns the mailbox.
This privilege separation limits the damage an attacker can cause through a flaw in protocol parsing, because the code that faces anonymous clients cannot read anybody’s mail. The following table summarizes the main services and their roles.
| Service | Role | Typical privilege |
|---|---|---|
| imap-login / pop3-login | Accept connections, negotiate TLS, collect credentials | Unprivileged, chrooted |
| auth | Verify passwords and look up user data | Dedicated auth user |
| imap / pop3 | Serve mailbox operations after login | The mailbox owner |
| lmtp | Receive messages from the MTA and store them | The recipient user |
| indexer-worker | Build full-text search indexes | The mailbox owner |
| doveadm-server | Administrative and replication commands | Privileged, local or restricted |
Configuration lives in dovecot.conf and an included conf.d directory, with each service, protocol and authentication method set in its own block. The doveadm tool exposes administrative functions such as mailbox inspection, quota recalculation, index repair and user lookups from the command line.
Mailbox formats and index files
Dovecot supports several mailbox storage formats, and the choice affects performance, backup strategy and compatibility with other software. All formats are accelerated by Dovecot’s own index, cache and log files, which store message flags, sizes and frequently requested header fields so that most client requests are answered without opening the message files.
| Format | Storage model | Best suited to |
|---|---|---|
| mbox | All messages of a folder in one file | Legacy systems and migrations |
| Maildir | One file per message, flags in file names | Interoperability with other tools |
| sdbox | One file per message, Dovecot metadata | Single-server deployments |
| mdbox | Several messages per file, central storage | Large installations with many messages |
| Object storage backends | Messages kept in a distributed object store | Very large commercial platforms |
Because indexes are rebuildable, a damaged index file usually causes slower access rather than data loss, and doveadm force-resync regenerates it. The dbox formats, however, depend on Dovecot’s metadata, so they should not be edited by other programs, while Maildir remains readable by many unrelated tools.
Authentication, delivery and the Sieve filter
The authentication subsystem separates two questions: whether the credentials are valid, answered by a passdb, and where the user’s mail lives, answered by a userdb. Both can draw on system accounts, flat password files, SQL databases, LDAP directories or external services, and passwords can be stored with strong schemes such as SHA512-CRYPT or Argon2.
Postfix can query Dovecot over a local socket for SMTP AUTH, so a single user database controls both submission and mailbox access. For incoming mail, the MTA hands each message to Dovecot through LMTP or the dovecot-lda program, which makes Dovecot the mail delivery agent in the chain and allows quota checks and filtering at delivery time.
Server-side filtering uses the Pigeonhole Sieve implementation, which runs user and administrator scripts at delivery to file messages into folders, reject or forward them, or send vacation replies. Users edit their scripts through the ManageSieve protocol, typically from a webmail interface.
How Dovecot compares with related email components
Dovecot is often confused with a complete mail server, but it does not relay mail between domains. A working mail system combines it with an MTA, a spam filter and DNS records such as SPF, DKIM and DMARC; the table below places Dovecot among its neighbors.
| Component | Main function | Relationship to Dovecot |
|---|---|---|
| Dovecot | Mailbox storage and IMAP/POP3 access | The component itself |
| Postfix or Exim | SMTP transfer between servers | Hands incoming mail to Dovecot via LMTP |
| Cyrus IMAP | Alternative mailbox server | Direct competitor with its own storage model |
| Spam filter | Scores and rejects unwanted mail | Runs before delivery, often in the MTA |
| Email client | Reads and sends mail for the user | Connects to Dovecot over IMAP |
| Webmail | Browser-based client | Acts as an IMAP client of Dovecot |
Compared with Cyrus, Dovecot is generally regarded as simpler to configure and more tolerant of mixed storage formats, while Cyrus offers its own murder clustering and integrated calendaring features.
Scaling, replication and protocol extensions
Dovecot scales from a single small server to platforms with millions of mailboxes. Small deployments run every service on one host, while large ones place Dovecot proxies in front of backend servers so that each user is routed consistently to the backend that holds the mailbox, which keeps index files consistent.
The dsync replication tool synchronizes mailboxes in both directions between two servers and is also used for migrations from other IMAP servers. Dovecot implements many IMAP extensions, including IDLE for push notifications, CONDSTORE and QRESYNC for fast resynchronization, and server-side full-text search through plugins.
- IDLE keeps a connection open so clients see new mail within seconds.
- QRESYNC lets a reconnecting client fetch only changed messages.
- Quota plugins enforce storage limits and report them to clients.
- Push notification plugins inform mobile services about new messages.
Common configuration mistakes
Most Dovecot problems come from permissions, authentication and TLS settings rather than from the software itself. The following table lists frequent symptoms with their causes and remedies.
| Symptom | Likely cause | Fix |
|---|---|---|
| Login fails with valid password | passdb and password scheme mismatch | Align the scheme prefix and test with doveadm auth test |
| Permission denied on mailbox | Wrong mail_uid or file ownership | Correct ownership and the userdb uid values |
| Clients warn about certificates | Expired or incomplete certificate chain | Install the full chain and reload |
| Plaintext logins accepted | disable_plaintext_auth not enforced | Require TLS before authentication |
| Slow folder opening | Corrupted or missing index files | Run doveadm force-resync |
A further risk is running outdated major versions. Dovecot 2.4 changed parts of the configuration syntax, so upgrades should be tested on a copy of the configuration with doveconf before production servers are switched.
Stripped to the essentials
Think of email as a postal system. The SMTP servers are the trucks that carry letters between towns. Dovecot is the post office box room: it keeps each person’s letters in a locked box, sorts them into folders and hands them over when the owner arrives with the right key.
Whenever a phone or laptop shows your inbox, it is usually talking to a program like Dovecot. It stores the mail, checks who you are and keeps every device in sync, so a message read on the phone also appears as read on the computer.
Where it is applied
A regional web hosting company runs mail for about 4,000 customer domains. Postfix receives messages on port 25, passes them through a spam filter and hands them to Dovecot over LMTP. Dovecot stores the mail in the mdbox format on a shared storage array, checks quotas of 5 to 50 GB per mailbox and runs customer Sieve rules that file newsletters and send vacation replies.
Customers connect from phones and desktop clients over IMAP on port 993, and the company’s webmail also talks to Dovecot over IMAP. Postfix authenticates outgoing submission on port 587 against the same Dovecot user database. When the company moved off an aging server, it used dsync to copy every mailbox with flags intact, and customers noticed no change apart from faster folder loading.