Postfix is an open-source mail transfer agent (MTA) that accepts, routes and delivers email using SMTP, and it is one of the most widely deployed mail servers in email infrastructure on the Internet. Wietse Venema created it in the late 1990s as a secure, fast and compatible alternative to Sendmail, and it is now the default MTA on many Linux distributions and BSD systems.
Postfix is distinguished by its modular, privilege-separated architecture: instead of one large program running with full system rights, it uses a set of small cooperating daemons, each with the least privilege needed for its task. It handles the transport of mail between servers, while a separate mail delivery agent such as Dovecot typically stores messages and serves them to users over IMAP or POP3.
How the Postfix architecture processes mail
Postfix processes mail through a pipeline of independent daemons supervised by the master process. The master starts each service on demand, limits how many instances run at once and restarts them after a fixed number of uses, which contains memory leaks and limits the impact of any single fault.
Mail enters through smtpd for network connections or through sendmail and postdrop for local submission, passes the cleanup daemon, which normalizes headers, and lands in the incoming queue. The queue manager (qmgr) then schedules delivery and hands each message to a delivery agent. The table below lists the core components and their roles.
| Component | Role | Runs chrooted by default |
|---|---|---|
| master | Supervises and starts all other daemons | No |
| smtpd | Receives mail from the network over SMTP | Configurable, often yes |
| cleanup | Adds missing headers, rewrites addresses, queues mail | Configurable |
| qmgr | Schedules delivery from the active queue | Configurable |
| smtp | Delivers mail to remote servers | Configurable |
| local | Delivers to local mailboxes or aliases | No, needs user rights |
| postscreen | Filters zombie clients before smtpd | Configurable |
Because no daemon that talks to the network runs as root, a vulnerability in smtpd does not grant full system control. This design is the main reason Postfix has a strong security record compared with monolithic MTAs of the same era.
Postfix queues and key configuration files
Postfix stores mail in separate queue directories, each representing a stage of processing. This separation lets the queue manager keep a small active queue in memory while thousands of deferred messages wait on disk, which protects performance when remote servers are slow or unreachable.
| Queue | Contents | Typical cause of growth |
|---|---|---|
| maildrop | Locally submitted mail awaiting pickup | Pickup daemon stopped |
| incoming | Newly received mail after cleanup | Short bursts of inbound traffic |
| active | Messages currently being delivered | Limited by qmgr, rarely large |
| deferred | Messages that failed temporarily | Remote greylisting, DNS or network faults |
| hold | Messages placed on hold by policy | Manual quarantine or content rules |
Configuration lives mainly in two files. main.cf holds global parameters such as myhostname, mydestination, relayhost and the TLS settings, while master.cf defines which services run, on which ports and with which overrides. Lookup tables in formats such as hash, LMDB, LDAP or SQL supply aliases, virtual domains and access rules.
The following parameters matter most when a server goes into production, because a wrong value in any of them can turn the server into an open relay or cause legitimate mail to bounce.
| Parameter | What it controls | Typical value |
|---|---|---|
mynetworks | Clients trusted to relay without authentication | 127.0.0.0/8 and the local subnet only |
smtpd_relay_restrictions | Who may send mail to external domains | permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination |
smtpd_tls_security_level | Inbound TLS policy | may (opportunistic STARTTLS) |
smtp_tls_security_level | Outbound TLS policy | may, or dane with DNSSEC |
message_size_limit | Largest accepted message | Often 25 to 50 MB |
maximal_queue_lifetime | How long deferred mail is retried | 5 days by default |
Postfix compared with other mail transfer agents
Postfix competes mainly with Exim and Sendmail, and the choice among them depends on security model, configuration style and ecosystem. All three speak standard SMTP and interoperate fully, so the decision affects administration rather than compatibility.
| MTA | Architecture | Configuration style | Typical environment |
|---|---|---|---|
| Postfix | Multiple privilege-separated daemons | Parameter files plus lookup tables | General-purpose servers, most Linux distributions |
| Exim | Single binary with flexible routers | Expressive, string-expansion language | Debian systems, hosting control panels |
| Sendmail | Largely monolithic | Macro-generated sendmail.cf | Legacy UNIX installations |
| OpenSMTPD | Privilege-separated, compact | Short, readable rule syntax | OpenBSD and small deployments |
Postfix offers a Sendmail-compatible command interface, so applications that call /usr/sbin/sendmail work unchanged. That compatibility made migration straightforward and helped Postfix displace Sendmail on most new installations.
Securing and authenticating mail with Postfix
A production Postfix server is secured through layered restrictions, encryption and sender authentication. Postfix itself handles SMTP transport and TLS, and it delegates signing and policy decisions to external components through the milter interface and the policy delegation protocol.
- STARTTLS on port 25 encrypts server-to-server traffic opportunistically, and MTA-STS or DANE can make it mandatory for selected domains.
- SASL authentication, usually provided by Dovecot, protects the submission service on port 587 or implicit TLS on port 465.
- DKIM signing is added by a milter such as OpenDKIM, while SPF and DMARC checks run through policy services or filters.
- postscreen and DNSBL lookups reject botnet connections before they consume smtpd processes.
- Greylisting through a policy daemon delays first-time senders and filters much automated spam.
Common Postfix mistakes and how to diagnose them
Most Postfix problems trace back to DNS, relay rules or TLS settings rather than to the software itself. The mail log, usually /var/log/mail.log or the system journal, records every queue ID and delivery status, and the commands postqueue -p, postcat and postconf -n reveal the queue contents and the active configuration.
| Symptom | Likely cause | Fix |
|---|---|---|
| Server relays spam for strangers | Overly broad mynetworks or missing reject_unauth_destination | Restrict trusted networks and restore relay restrictions |
| Outbound mail rejected by large providers | Missing PTR record, SPF or DKIM | Align reverse DNS and publish authentication records |
| Deferred queue keeps growing | Remote greylisting, blocklisting or DNS failure | Read the deferral reason with postqueue and postcat |
| Mail loops back to itself | Domain listed in both mydestination and virtual domains | List each domain in one address class only |
| TLS handshake failures in the log | Expired certificate or outdated protocol settings | Renew the certificate and allow TLS 1.2 or newer |
A sound habit is to run postfix check after every configuration change and to reload rather than restart the service, which applies new settings without dropping active connections.
A plain-language summary
Postfix is the post office sorting center of an email system. When someone sends a message, Postfix receives it, decides where it needs to go and hands it to the next post office or to the right local mailbox.
It is built like a well-run sorting center with separate rooms for separate jobs. The person at the front desk cannot open the vault, so a problem in one room does not spread to the others. That careful division is why Postfix is trusted to move mail safely on a very large number of servers.
An example from practice
A university IT team runs email for about 8,000 staff and students on two Linux servers. Postfix handles inbound and outbound SMTP, Dovecot stores mailboxes and provides SASL authentication, and OpenDKIM signs every outgoing message. Students send mail through the submission service on port 587 after logging in, while the public port 25 accepts only mail addressed to university domains.
After a phishing campaign compromised several student passwords, the team noticed the deferred queue growing to more than 20,000 messages because a major provider had started throttling the university. They used the mail log to identify the abused accounts, reset the credentials, purged the spam with postsuper and added a per-user sending rate limit through a policy service. Within two days the deferred queue was empty and the provider lifted its throttling, restoring normal delivery for legitimate users.