1997: qmail: The Secure Mail Server That Rewrote the Rules
In the mid-1990s, email security was a contradiction in terms. Sendmail, which routed the vast majority of the internet’s messages, was a regular source of CERT advisories. Buffer overflows, format string vulnerabilities, remote code execution — the flaws came so frequently that many administrators treated sendmail patches as a routine part of their weekly schedule, like taking out the trash.
Daniel J. Bernstein thought this was insane. And unlike most people who thought this was insane, he decided to do something about it.
The Mathematician’s Approach
Bernstein was not a typical systems programmer. He was a mathematician and cryptographer at the University of Illinois at Chicago, known for his work on elliptic-curve cryptography and his legal battle with the U.S. government over the right to publish cryptographic source code (Bernstein v. United States, a landmark case for software as protected speech). He approached software engineering the way he approached mathematics: with a focus on provable correctness and an intolerance for sloppy reasoning.
His analysis of sendmail’s security problems led him to a conclusion that went beyond “sendmail has bugs.” The fundamental problem, Bernstein argued, was architectural. Sendmail was a monolithic program that ran as root and handled everything — receiving mail, routing, delivery, alias expansion, address rewriting — in a single process. Any vulnerability in any part of the program gave an attacker root access to the entire server. The attack surface was enormous.
Bernstein’s solution was radical: don’t write a better sendmail. Write a completely different kind of mail server.
The Architecture
qmail, first released in January 1996 as a beta and reaching version 1.0 in February 1997, was built around the principle of privilege separation. Instead of one monolithic program running as root, qmail consisted of multiple small programs, each running with minimal privileges and responsible for a single task.
The qmail-smtpd daemon accepted incoming SMTP connections but ran as an unprivileged user. It couldn’t write to the mail queue directly — it handed messages to qmail-queue, which was one of the very few components that needed elevated privileges, and which was small enough to audit thoroughly. qmail-send processed the queue and handed messages to qmail-lspawn (for local delivery) or qmail-rspawn (for remote delivery), each running with appropriately limited permissions.
This meant that even if an attacker found a vulnerability in the SMTP-facing code — the component most exposed to the internet — they would only compromise an unprivileged process. They wouldn’t get root. They wouldn’t be able to read other users’ mail. They wouldn’t be able to modify the system. The blast radius of any single vulnerability was contained by design.
Bernstein also made deliberate choices to reduce complexity. qmail didn’t try to handle every edge case that sendmail accommodated. It didn’t support sendmail’s baroque address rewriting rules. It didn’t attempt backward compatibility with every obscure mail protocol. By doing less, it had less code, and less code meant fewer places for bugs to hide.
The $500 Guarantee
Bernstein was so confident in qmail’s security that he publicly offered a $500 guarantee: he would pay $500 to the first person who could demonstrate a verifiable security hole in the latest version of qmail. This was in 1997, when $500 was not a trivial sum and when security bounty programs were essentially unheard of (Bug bounty programs wouldn’t become mainstream for another decade).
The bounty was never collected. Over the years, a handful of theoretical vulnerabilities were identified — edge cases involving integer overflows on systems with specific configurations — but none met Bernstein’s strict criteria for a “verifiable security hole.” The debate about whether these edge cases counted became a minor internet flame war, but the practical record was clear: qmail, in its default configuration, was never successfully exploited in the wild.
This track record was remarkable given that qmail was deployed on millions of servers and handled enormous volumes of email. Yahoo Mail ran on qmail for years. PayPal ran on qmail. These were among the highest-value targets on the internet, and qmail held.
The Ecosystem
qmail’s minimalist design philosophy meant it didn’t include features many administrators needed out of the box. It didn’t come with POP3 or IMAP servers. It didn’t include a web-based administration interface. It didn’t have built-in mailing list management.
This spawned an ecosystem of third-party tools that filled the gaps. Courier-IMAP and Dovecot provided IMAP access. vpopmail added virtual domain management. qmail-scanner and SpamAssassin handled spam filtering. ezmlm managed mailing lists. Community-maintained patch sets — most notably the “netqmail” distribution — collected essential patches into a single, tested bundle.
The qmailrocks website became the canonical resource for administrators setting up qmail-based mail servers, providing step-by-step guides for assembling these components into a complete mail system. For a generation of Linux administrators in the early 2000s, following a qmailrocks tutorial was a rite of passage.
Companies like Rozmic built managed email services on the qmail foundation — filtering spam and viruses before they reached customer inboxes. This model of cloud-based email security, where a service provider sits between the internet and your mail server, became the foundation of modern email security gateways. The commercial ecosystem around qmail demonstrated that open-source mail infrastructure could support serious business operations.
The License Problem
qmail’s adoption was significantly hampered by its licensing. Bernstein did not release qmail under any standard open-source license. Instead, he maintained restrictive terms: you could use the source code, but you couldn’t distribute modified versions. If you wanted to apply patches (and virtually everyone needed to), you had to distribute the original source alongside a separate patch file. Binary distribution of modified versions was not permitted.
For Linux distributions, which needed to package software in easily installable formats, this was a deal-breaker. Debian, Red Hat, and others couldn’t include qmail in their repositories. Administrators who wanted qmail had to compile it from source, download patches separately, and apply them manually. This was manageable for experienced admins but created a significant barrier to adoption compared to MTAs that could be installed with a single apt-get install command.
The licensing situation wasn’t resolved until November 2007, when Bernstein placed qmail in the public domain. By then, the damage was done. Postfix and Exim had spent a decade being trivially installable on every major Linux distribution, building communities and market share while qmail’s growth was constrained by its distribution limitations.
Yahoo and the Scale Test
Perhaps the most compelling endorsement of qmail’s architecture came from Yahoo. In the late 1990s and 2000s, Yahoo Mail was one of the largest email services in the world, and it ran on qmail. Yahoo’s engineers chose qmail specifically for its security and reliability, and they operated it at a scale that tested every assumption about how email software should work.
Yahoo’s deployment proved that qmail could handle millions of users and billions of messages. The security architecture held at scale. The modular design allowed Yahoo’s engineers to optimize individual components without risking the stability of the whole system. This was exactly the kind of validation Bernstein had designed for.
PayPal similarly ran qmail for its transaction notification infrastructure — email that was both high-volume and mission-critical. When your business depends on every email reaching its destination and no unauthorized access occurring, the choice of MTA matters enormously. PayPal’s use of qmail was a strong signal that the security guarantees were real.
The Influence
qmail’s direct market share peaked in the early 2000s and has been declining since. Few new deployments choose qmail today, and the ecosystem of supporting tools has largely stagnated. As a product, qmail’s moment has passed.
As a set of ideas, however, qmail’s influence is everywhere. Privilege separation — the principle that different parts of a system should run with different, minimal permissions — became standard practice in security-conscious software design. OpenSSH, developed shortly after qmail, used the same approach. Modern container architectures embody the same philosophy: isolate components so that a compromise in one doesn’t cascade to others.
Postfix, which eventually became the most popular MTA, was explicitly designed with qmail’s security lessons in mind. Wietse Venema acknowledged Bernstein’s influence on Postfix’s architecture — the modular design, the privilege separation, the principle of minimal trust between components. The differences between Postfix and qmail are largely differences of philosophy (pragmatism vs. purism) rather than fundamentals.
Bernstein’s $500 bounty also foreshadowed the bug bounty programs that are now standard practice at major technology companies. The idea that you could be confident enough in your software’s security to put money behind it — and that the existence of the bounty would attract auditing attention that would either find bugs or build confidence — was prescient.
The Bernstein Factor
It’s impossible to separate qmail from its creator’s personality. Bernstein is brilliant, opinionated, and uncompromising. These qualities produced software of exceptional security and a licensing arrangement that hampered adoption. They produced a bug bounty that proved its point and a refusal to acknowledge edge-case vulnerabilities that frustrated the security community.
qmail is, in many ways, a mirror of the person who wrote it: technically excellent, principled to a fault, and difficult to work with unless you’re willing to accept things exactly as they are. In the messy, compromising world of internet infrastructure, that combination produced something unique — a mail server that proved secure email was possible, even if it couldn’t convince the world to adopt it.
The question of whether qmail or Postfix represents the better philosophy is one we explore in our overview of The Great MTA Wars. But whatever side you take, the debt the email world owes to Bernstein’s uncompromising vision is hard to overstate.
Infographic
Share this visual summary. Right-click to save.
Related Events
Frequently Asked Questions
What is qmail?
qmail is a mail transfer agent (MTA) written by Daniel J. Bernstein, first released in 1997. It was designed from the ground up for security, using privilege separation and a modular architecture that minimized the amount of code running with elevated permissions.
Why did Dan Bernstein write qmail?
Bernstein was frustrated by the chronic security vulnerabilities in sendmail, which handled most of the internet's email at the time. He believed that a mail server could be designed to be fundamentally secure rather than constantly patched, and he wrote qmail to prove it.
Is qmail still used today?
qmail is still running on some legacy systems, but new deployments are rare. Its long period under a restrictive license stunted ecosystem growth, and most administrators have migrated to Postfix or Exim. However, qmail's security architecture influenced every MTA that followed it.
Stay ahead of the inbox
Weekly tips on deliverability, automation, and growing your list. No spam, ever.
No spam. Unsubscribe any time. We respect your inbox.