qmail

Book description

qmail has quietly become one of the most widely used applications on the Internet today. It's powerful enough to handle mail for systems with millions of users--Like Yahoo! Mail and Hotmail, while remaining compact and manageable enough for the smallest Unix- and Linux-based PC systems. Its component design makes it easy to extend and customize while keeping its key functions secure, so it's no wonder that adoption of qmail continues at a rapid pace.The downside? Apparently none. Except that qmail's unique design can be disorienting to those familiar with other popular MTAs (Mail Transfer Agents). If you're coming from sendmail, for instance, you might have trouble recasting your problems and solutions in qmail terms. qmail first helps you establish a "qmail frame of mind," then explores the installation, configuration, administration, and extension of this powerful MTA. Whether you're installing from scratch or managing mailing lists with thousands of users, qmail provides detailed information about how to make qmail do precisely what you wantqmail concentrates on common tasks like moving a sendmail setup to qmail, or setting up a "POP toaster," a system that provides mail service to a large number of users on other computers sending and retrieving mail remotely. The book also fills crucial gaps in existing documentation, detailing exactly what the core qmail software does.Topics covered include:

  • Installation and configuration, including patching qmail
  • Moving from sendmail to qmail
  • Handling locally and remotely originated messages
  • Managing virtual domains
  • Logging qmail activity
  • Tuning qmail performance
  • Running multiple copies of qmail on the same computer
  • Mailing list setup and management
  • Integrating the qmail MTA with POP and IMAP delivery
  • Filtering out spam and viruses
If you need to manage mailing lists, large volumes of mail, or simply find sendmail and other MTAs too complicated, qmail may be exactly what's called for. Our new guide, qmail, will provide the guidance you need to build an email infrastructure that performs well, makes sense, and is easy to maintain.

Publisher resources

View/Submit Errata

Table of contents

  1. Preface
    1. What’s Inside?
      1. Part I: Introduction to Qmail
      2. Part II: Advanced Qmail
    2. Style Conventions
    3. Examples and Patches
    4. Comments and Questions
    5. Acknowledgments
  2. I. Introduction to Qmail
    1. 1. Internet Email
      1. 1.1. Mail Basics
        1. 1.1.1. Addresses
        2. 1.1.2. Envelopes
        3. 1.1.3. Messages
        4. 1.1.4. Lines
      2. 1.2. Mailstore
        1. 1.2.1. Transparent Mailstore
        2. 1.2.2. Opaque Mailstore
          1. 1.2.2.1. POP3
          2. 1.2.2.2. IMAP4
      3. 1.3. The Structure of Internet Mail
    2. 2. How Qmail Works
      1. 2.1. Small Programs Work Together
        1. 2.1.1. Each Program Does One Thing
        2. 2.1.2. The Principle of Least Privilege
        3. 2.1.3. Program Wrapping
        4. 2.1.4. No New Languages
        5. 2.1.5. Configuration Files
      2. 2.2. What Does a Mail Transfer Agent (MTA) Do?
      3. 2.3. The Pieces of Qmail
        1. 2.3.1. A Message’s Path Through Qmail
    3. 3. Installing Qmail
      1. 3.1. Where to Find Qmail
        1. 3.1.1. Copyright
        2. 3.1.2. Should I Upgrade?
        3. 3.1.3. Other Software You Should Fetch
      2. 3.2. Creating the Users and Groups
        1. 3.2.1. The adduser Script
        2. 3.2.2. Adding by Hand
        3. 3.2.3. Nofiles Group Really Has No Files
      3. 3.3. Configuring and Making the Software
        1. 3.3.1. conf-break
        2. 3.3.2. conf-cc
        3. 3.3.3. conf-groups
        4. 3.3.4. conf-ld
        5. 3.3.5. conf-patrn
        6. 3.3.6. conf-qmail
        7. 3.3.7. conf-spawn
        8. 3.3.8. conf-split
        9. 3.3.9. conf-users
        10. 3.3.10. Build Using make
        11. 3.3.11. If the Build Fails
        12. 3.3.12. Building the Other Packages
        13. 3.3.13. Installing Qmail
        14. 3.3.14. Installing Other Programs
      4. 3.4. Patching Qmail
    4. 4. Getting Comfortable with Qmail
      1. 4.1. Mailboxes, Local Delivery, and Logging
        1. 4.1.1. Mailbox Format
        2. 4.1.2. Local Delivery
        3. 4.1.3. Logging
      2. 4.2. An Excursion into Daemon Management
        1. 4.2.1. Starting a Daemon
      3. 4.3. Setting Up the Qmail Configuration Files
      4. 4.4. Starting and Stopping Qmail
        1. 4.4.1. Choosing a Startup File
        2. 4.4.2. Fire `er Up
        3. 4.4.3. Stopping Qmail
      5. 4.5. Incoming Mail
        1. 4.5.1. Configuration Files
        2. 4.5.2. Setting Up the Daemons
        3. 4.5.3. Make Some Mail Aliases
        4. 4.5.4. Relaying for Local Users
      6. 4.6. Procmail and Qmail
      7. 4.7. Creating Addresses and Mailboxes
      8. 4.8. Reading Your Mail
      9. 4.9. Configuring Qmail’s Control Files
      10. 4.10. Using ~alias
      11. 4.11. fastforward and /etc/aliases
        1. 4.11.1. Installing fastforward
        2. 4.11.2. Using fastforward
        3. 4.11.3. Alias File Format
    5. 5. Moving from Sendmail to Qmail
      1. 5.1. Running Sendmail and Qmail in Parallel
        1. 5.1.1. Sendmail Switching Systems
      2. 5.2. User Issues
        1. 5.2.1. Mailbox Format and Location
        2. 5.2.2. Qmail and .forward Files
      3. 5.3. System Issues
        1. 5.3.1. Deconstructing sendmail.cf
        2. 5.3.2. Local Deliveries
        3. 5.3.3. Hostnames and Masquerading
        4. 5.3.4. Local and Virtual Domains
        5. 5.3.5. Remote Domains, and Primary and Backup MXes
        6. 5.3.6. Smarthosts
        7. 5.3.7. Uucp and Other Specialized Deliveries
        8. 5.3.8. Spam Filtering
      4. 5.4. Converting Your Aliases File
        1. 5.4.1. Address Forwarding
        2. 5.4.2. Mailing Lists
        3. 5.4.3. Program Deliveries
      5. 5.5. Trusted Users
    6. 6. Handling Locally Generated Mail
      1. 6.1. qmail-queue
        1. 6.1.1. Passing Input to qmail-queue
        2. 6.1.2. Other Queueing Programs
        3. 6.1.3. Wrapping qmail-queue
      2. 6.2. Cleaning Up Injected Mail
        1. 6.2.1. Accepting and Cleaning Up Locally Injected Mail
          1. 6.2.1.1. Setting the envelope addresses
          2. 6.2.1.2. Header rewriting
          3. 6.2.1.3. Address rewriting
        2. 6.2.2. Passing in Large Numbers of Addresses
      3. 6.3. Accepting Local Mail from Other Hosts
      4. 6.4. Distinguishing Injected from Relayed Mail
    7. 7. Accepting Mail from Other Hosts
      1. 7.1. Accepting Incoming SMTP Mail
      2. 7.2. Accepting and Cleaning Up Local Mail Using the Regular SMTP Daemon
        1. 7.2.1. Using Separate Relay and Injection Daemons
        2. 7.2.2. Deciding On the Fly Which Daemon to Use
      3. 7.3. Dealing with Roaming Users
      4. 7.4. SMTP Authorization and TLS Security
        1. 7.4.1. Installing and Building SMTP AUTH and (Optionally) TLS
      5. 7.5. POP-before-SMTP
        1. 7.5.1. Adding POP-before-SMTP to the POP Server
        2. 7.5.2. Adding POP-Before-SMTP to the SMTP Server
        3. 7.5.3. Using POP-before-SMTP with ofmipd
        4. 7.5.4. Other POP-before-SMTP Daemons
    8. 8. Delivering and Routing Local Mail
      1. 8.1. Mail to Local Login Users
        1. 8.1.1. Local Delivery .qmail Files and Default Delivery Rules
        2. 8.1.2. Maildirs and Mail Clients
      2. 8.2. Mail Sorting
        1. 8.2.1. Mail Sorting with Subaddresses
        2. 8.2.2. Mail Sorting with Filter Programs
          1. 8.2.2.1. Mail sorting with procmail
          2. 8.2.2.2. Mail sorting with maildrop
        3. 8.2.3. More Mail Sorting
    9. 9. Filtering and Rejecting Spam and Viruses
      1. 9.1. Filtering Criteria
      2. 9.2. Places to Filter
      3. 9.3. Spam Filtering and Virus Filtering
      4. 9.4. Connection-Time Filtering Tools
        1. 9.4.1. Using Local Filtering Rules
        2. 9.4.2. Using DNSBLs and DNSWLs
      5. 9.5. SMTP-Time Filtering Tools
        1. 9.5.1. Filtering in the SMTP Daemon
        2. 9.5.2. Separate Filters Called from the SMTP Daemon
          1. 9.5.2.1. Filtering with qmail-qfilter
          2. 9.5.2.2. Filtering with qmail-scanner
      6. 9.6. Delivery Time Filtering Rules
      7. 9.7. Combination Filtering Schemes
  3. II. Advanced Qmail
    1. 10. Local Mail Delivery
      1. 10.1. How Qmail Delivers Local Mail
        1. 10.1.1. Identifying the User
        2. 10.1.2. Locating the .qmail File
        3. 10.1.3. Processing the .qmail File
        4. 10.1.4. Defensive Features in qmail-local
      2. 10.2. Mailbox Deliveries
      3. 10.3. Program Deliveries
        1. 10.3.1. Delivery Utilities
          1. 10.3.1.1. forward
          2. 10.3.1.2. bouncesaying
          3. 10.3.1.3. condredirect
          4. 10.3.1.4. except
      4. 10.4. Subaddresses
      5. 10.5. Special Forwarding Features for Mailing Lists
      6. 10.6. The Users Database
      7. 10.7. Bounce Handling
        1. 10.7.1. Single Bounces
        2. 10.7.2. Double Bounces
        3. 10.7.3. Triple Bounces
    2. 11. Remote Mail Delivery
      1. 11.1. Telling Local from Remote Mail
      2. 11.2. qmail-remote
      3. 11.3. Locating the Remote Mail Host
        1. 11.3.1. The smtproutes File for Outbound Mail
        2. 11.3.2. Secondary MX Servers for Inbound Mail
        3. 11.3.3. TCP Time-Outs
      4. 11.4. Remote Mail Failures
      5. 11.5. Serialmail
        1. 11.5.1. Using Serialmail
    3. 12. Virtual Domains
      1. 12.1. How Virtual Domains Work
      2. 12.2. Some Common Virtual Domain Setups
        1. 12.2.1. Mapping a Few Addresses with .qmail Files
        2. 12.2.2. Mapping Many Addresses with fastforward
        3. 12.2.3. Per-User Subdomains
        4. 12.2.4. Service Gateways
          1. 12.2.4.1. Gateway design
          2. 12.2.4.2. Gateway addressing
          3. 12.2.4.3. Per-message service gateways
          4. 12.2.4.4. Batched service gateways
        5. 12.2.5. Mapping Individual Addresses
        6. 12.2.6. POP Toasters
      3. 12.3. Some Virtual Domain Details
        1. 12.3.1. qmail-foo Versus qmail-alias-foo
        2. 12.3.2. Local-Only Domains
    4. 13. POP and IMAP Servers and POP Toasters
      1. 13.1. Each Program Does One Thing
        1. 13.1.1. The Flow of Control
        2. 13.1.2. Functional Partitioning
          1. 13.1.2.1. Flexibility
          2. 13.1.2.2. Testability
      2. 13.2. Starting the Pop Server
        1. 13.2.1. Prerequisite Packages
        2. 13.2.2. Directories
        3. 13.2.3. The Listening Script
        4. 13.2.4. The Logging Script
        5. 13.2.5. tcpserver Rules
        6. 13.2.6. Putting It All Together
      3. 13.3. Testing Your POP Server
        1. 13.3.1. You Cannot Connect to the POP Server
        2. 13.3.2. You Can Connect, but Then Something Fails
      4. 13.4. Building POP Toasters
        1. 13.4.1. Installing Vpopmail
        2. 13.4.2. Setting Up Vpopmail
          1. 13.4.2.1. Creating virtual domains
          2. 13.4.2.2. Creating mailboxes
          3. 13.4.2.3. Starting the POP service
          4. 13.4.2.4. Roaming users
        3. 13.4.3. Some Handy Vpopmail Tricks
          1. 13.4.3.1. Handling unknown users
          2. 13.4.3.2. Forwarding a user’s mail and other per-user special handling
          3. 13.4.3.3. Enforcing mail quotas
          4. 13.4.3.4. Mail bulletins
          5. 13.4.3.5. Storing user data in a database
          6. 13.4.3.6. Data replication and other MySQL tricks
      5. 13.5. Picking Up Mail with IMAP and Web Mail
        1. 13.5.1. Courier’s Extended Maildir++
        2. 13.5.2. Installing Courier IMAP
        3. 13.5.3. Courier IMAP and Pop-Before-SMTP
        4. 13.5.4. Installing SqWebMail
    5. 14. Mailing Lists
      1. 14.1. Sending Mail to Lists
        1. 14.1.1. Maintaining List Files
        2. 14.1.2. Bounce Handling and VERP
          1. 14.1.2.1. Manual bounce handling
          2. 14.1.2.2. Automated bounce handling
          3. 14.1.2.3. Bounce handling for mail without .qmail file forwarding
      2. 14.2. Using Ezmlm with qmail
        1. 14.2.1. Installing Ezmlm-idx
        2. 14.2.2. Ezmlm List Names
        3. 14.2.3. Creating an Ezmlm List
        4. 14.2.4. Ezmlm Lists in Virtual Domains
        5. 14.2.5. Sending Mail to and Testing an Ezmlm List
        6. 14.2.6. Configuring and Maintaining an Ezmlm List
        7. 14.2.7. Other Ezmlm Tricks and Features
      3. 14.3. Using Other List Managers with Qmail
        1. 14.3.1. Incoming Mail to List Managers
        2. 14.3.2. Outgoing Mail from List Managers
      4. 14.4. Sending Bulk Mail That’s Not All the Same
    6. 15. The Users Database
      1. 15.1. If There’s No Users Database
      2. 15.2. Making the Users File
      3. 15.3. How Qmail Uses the Users Database
      4. 15.4. Typical Users Setup
      5. 15.5. Adding Entries for Special Purposes
        1. 15.5.1. Adding a Few Mail-Only Accounts
        2. 15.5.2. Preparing for the POP Toaster
    7. 16. Logging, Analysis, and Tuning
      1. 16.1. What Qmail Logs
      2. 16.2. Collecting and Analyzing Qmail Logs with Qmailanalog
        1. 16.2.1. Log Analysis at Rotation Time
        2. 16.2.2. Log Analysis Once a Day
        3. 16.2.3. Getting Statistics with Qmailanalog
      3. 16.3. Analyzing Other Logs
      4. 16.4. Tuning Qmail
        1. 16.4.1. Tuning Small Servers
        2. 16.4.2. Tuning Large Servers
      5. 16.5. Tuning to Deal with Spam
      6. 16.6. Looking at the Mail Queue with qmail-qread
    8. 17. Many Qmails Make Light Work
      1. 17.1. Tools for Multiple Computers and Qmail
        1. 17.1.1. Multiple Copies of Qmail
        2. 17.1.2. mini-qmail
        3. 17.1.3. Shared Mail Folders
        4. 17.1.4. Multi-Host POP Toasters
      2. 17.2. Setting Up mini-qmail
        1. 17.2.1. Setting Up a QMQP Server
        2. 17.2.2. Setting Up QMQP Clients
        3. 17.2.3. Using QMQP
          1. 17.2.3.1. Using a smarthost
          2. 17.2.3.2. Setting up a mail firewall
          3. 17.2.3.3. Mailing list load sharing
    9. 18. A Compendium of Tips and Tricks
      1. 18.1. Qmail Won’t Compile
      2. 18.2. Why Qmail Is Delivering Mail Very Slowly
      3. 18.3. Stuck Daemons and Deliveries
        1. 18.3.1. Daemons Won’t Start, or They Start and Crash Every Few Seconds
        2. 18.3.2. Nothing Gets Logged
        3. 18.3.3. Daemons Are Running but Making No Progress
        4. 18.3.4. Mail Rejected with Stray Newline Reports
      4. 18.4. Mail to Valid Users Is Bouncing or Disappearing
      5. 18.5. Mail Routing
        1. 18.5.1. Sending All Mail to a Smarthost
        2. 18.5.2. Treating a Few Remote Addresses as Local
        3. 18.5.3. Slowing Mail Delivery to Certain Domains
      6. 18.6. Local Mail Delivery Tricks
        1. 18.6.1. Using a Subaddress Separator Character Other than Hyphen
        2. 18.6.2. Customized Bounce Messages for Virtual Domains
      7. 18.7. Delivering Mail on Intermittent Connections
      8. 18.8. Limiting Users’ Mail Access
      9. 18.9. Adding a Tag to Each Outgoing Message
      10. 18.10. Logging All Mail
      11. 18.11. Setting Mail Quotas and Deleting Stale Mail
      12. 18.12. Backing Up and Restoring Your Mail Queue
    10. A. A Sample Script
      1. A.1. A Mail-to-News Gateway
    11. B. Online Qmail Resources
      1. B.1. Web Sites
      2. B.2. Mailing Lists
  4. Index
  5. About the Author
  6. Colophon
  7. Copyright

Product information

  • Title: qmail
  • Author(s): John Levine
  • Release date: March 2004
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781565926288