Thank you for downloading Qmail Quickstarter About Packt Publishing Packt, pronounced 'packed', published its first book "Mastering phpMyAdmin for Effective MySQL Management" in April 2004 and subsequently continued to specialize in publishing highly focused books on specific technologies and solutions Our books and publications share the experiences of your fellow IT professionals in adapting and customizing today's systems, applications, and frameworks Our solution based books give you the knowledge and power to customize the software and technologies you're using to get the job done Packt books are more specific and less general than the IT books you have seen in the past Our unique business model allows us to bring you more focused information, giving you more of what you need to know, and less of what you don't Packt is a modern, yet unique publishing company, which focuses on producing quality, cutting-edge books for communities of developers, administrators, and newbies alike For more information, please visit our website: www.packtpub.com Packt’s Brand Launch Packt Publishing has recently launched two new brands, Packt Enterprise and Packt Open Source, improving further our ability to focus on very specific, and sometimes niche, areas Our Editors and Development Teams are now able to dig deeply into their specialist areas of either Enterprise or Open Source technology, improving our books’ focus and relevance Packt Open Source Packt Open Source will be home to books published on software built around Open Source licences, offering information to anybody from advanced developers to budding web designers The Open Source brand will also be taking on Packt’s Open Source Royalty Scheme, and continuing to broaden Packt’s contribution to the Open Source community Previous titles which would, if published today, slot into the Open Source brand include: • • • • • Magento 1.3: PHP Developer's Guide jQuery 1.4 Reference Guide WordPress 2.8 Theme Design Moodle 1.9 Teaching Techniques Drupal E-commerce with Ubercart 2.x Qmail Quickstarter Install, Set Up, and Run your own Email Server A fast-paced and easy-to-follow, step-by-step guide that gets you up and running quickly Kyle Wheeler Qmail Quickstarter Install, Set Up, and Run your own Email Server Copyright © 2007 Packt Publishing All rights reserved No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews Every effort has been made in the preparation of this book to ensure the accuracy of the information presented However, the information contained in this book is sold without warranty, either express or implied Neither the author, Packt Publishing, nor its dealers or distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book Packt Publishing has endeavored to provide trademark information about all the companies and products mentioned in this book by the appropriate use of capitals However, Packt Publishing cannot guarantee the accuracy of this information First published: June 2007 Production Reference: 1040607 Published by Packt Publishing Ltd 32 Lincoln Road Olton Birmingham, B27 6PA, UK ISBN 978-1-847191-15-1 www.packtpub.com Cover Image by Vinayak Chittar (vinayak.chittar@gmail.com) Credits Author Kyle Wheeler Reviewer Russell Nelson Development Editor Nanda Padmanabhan Assistant Development Editor Rashmi Phadnis Technical Editor Saurabh Singh Code Testing Ankur Shah Project Manager Patricia Weir Editorial Manager Dipali Chittar Project Coordinator Abhijeet Deobhakta Indexer Bhushan Pangaonkar Proofreader Chris Smith Production Coordinator Manjiri Nadkarni Cover Designer Manjiri Nadkarni About the Author Kyle Wheeler is a PhD candidate at the University of Notre Dame in the Computer Science and Engineering Department Having co-authored papers both nationally and internationally, he received an M.S.C.S.E from Notre Dame in 2005 and expects to receive his doctorate in the field of scalable computing in 2008 As part of his PhD research, he interned at Sandia National Laboratories from 2006 through 2007 Kyle began setting up and maintaining qmail-based email servers working for NetSeats Inc in 2000 Since then, his client base has expanded to include the Philadelphia chapter of Notre Dame Alumni, the Church of Epiphany in the Archdiocese of Louisville, and several other groups, both large and small He is also a frequent contributor to the qmail mailing list, which supports qmail users and administrators internationally I'd like to thank my family and my fiancée for their constant support while writing this book About the Reviewer Russell Nelson has been a postmaster for twenty years, about half of them using qmail In a previous life, he was Mr Packet Driver, but people still remember him that way Russell blogs at http://blog.russnelson.com/ Table of Contents Preface Chapter 1: Basic Qmail The Minimum Qmail System Compiling and Installing Preparing the System Compiling and Installing the Necessary Binaries Creating the Basic Configuration Files Creating the Necessary Minimum Account Aliases Default Mail Delivery Basic Configuration Simple Execution qmail-start qmail-smtpd 5 6 7 10 12 12 14 Administrative Conveniences About Patches ucspi-tcp and daemontools 15 15 16 Using tcpserver Using svscan Logging The Overall Structure of Qmail Summary 17 19 19 21 25 Installation Chapter 2: Getting Email into the Queue qmail-queue and the Qmail Queue The qmail-inject and sendmail Interfaces qmail-smtpd and the QMAILQUEUE Patch Accepting or Rejecting Email 17 27 27 28 30 30 Table of Contents RELAYCLIENT and Authentication tcprules POP-before-SMTP SMTP-AUTH The QMAILQUEUE Patch Other Mail Protocols Quick Mail Transfer Protocol (QMTP) Old-Fashioned Mail Injection Protocol (OFMIP) Summary Chapter 3: Getting Email Out of the Queue qmail-send and the Qmail Queue Delivering Email Locally The Default qmail Files Forwards Maildirs and mboxes Pipes and Programs Supporting forward Files Users The virtualdomains File Defined Users: The users/assign File Aliases Extensions Delivering Email Remotely How It Normally Works Static Routes Authentication Summary Chapter 4: Storing and Retrieving Email Popular Storage Formats Reliability Speed Reading Marking Deleting Delivery Searching 31 31 32 34 35 36 36 37 38 39 40 41 41 41 42 42 43 46 47 47 48 48 48 50 50 51 52 53 55 55 57 58 59 59 60 60 60 On-Disk Efficiency The POP3 and IMAP Protocols Protocol and Server Selection 61 62 62 [ ii ] Chapter #!/bin/sh cat /var/log/qmail/send/current | \ tai64n2tai | \ matchup 5>/dev/null | \ zfailures | \ awk 'NR>8' | sort -n -r | awk 'NR