2010/03/12

The Labs.Com Admin Lab QMail
Last update 2004/03/23

The Labs - Design & Functionality For The Net

QMail - The Sendmail Replacement

  1. Introduction
  2. DOTQM
  3. QMLOCK
  4. Other QMail Tools
QMail
1. Introduction
qmail is a sendmail replacement which is very stable and secure:
QMail.Org
Main site
QMail-1.03 Man Pages
local copy

All projects we developed we use qmail solely, it takes 2-3hrs the first time to set it up, but it's worth once you did it, we recommend to read the MAN pages carefully; since qmail is implemented in the light of modularity and security, (e.g. qmail doesn't accept group/world writable .qmail-files) so an aware system-admin is required to install and use it.

Especially when you are web-hosting ISP, qmail makes virtual hosting quite easy, and no longer editing cryptic sendmail config files.

QMail
2. DOTQM

dotqm is a small perl-script which helps to maintain dot-qmail files (.qmail-*). One central file (with possibility to include others) you control all actions. Since qmail is ideal for virtual hosting, one real account handles an entire domain then dotqm is very useful.

Download

 dotqm the perl-source
$MyVersion: 0.001 - Wed Jan 26 10:40:46 MET 2000 - kiwi$

Usage

 Should a .dotqmrc exist then it will be automatically used in case no arguments are given. -v is the verbose-switch.

The file should look like this:

 # comment-line, it's ignored 
 email-address     action 1 
 email-address2    action 2 
 etc. 

The email-address can be a full-qualified, or just the login.

Within your /var/qmail/control/ you setup for an user his virtual domain, so all email is forwarded to ~user, and here dotqm is usable to maintain all local forwardings for a particular user.

Example

 

dotqmrc:

 # --- DOTQM Resource Sample File 
  
 #include <lists.qm> 
  
 john@example.com         &john@heaven.com 
 text-forward@example.com |preline procmail -f 
 info@example.com         |preline autoreply 

lists.qm:

 # --- My mailing-lists 
  
 friends-l   |preline list-handler -f friends-l 
 buddies-l   |preline list-handler -f buddies-l 
  lovers-l   |preline list-handler -f lovers-l 
 enemies-l   |preline list-handler -f enemies-l 

 % dotqm dotqmrc 

which will create all .qmail-files.

In case you need a 'non-delivery' case, a default, then use like this:

 default         john@heaven.com 

qmail-local Features

 Within the .qmail-files you can have different actions:
  1. Mail-forwarding: email-address
    e.g. john@heaven.com or &john@heaven.com

  2. Mailbox: ./mbox-file
    e.g. ./mbox

  3. Maildir: ./maildir/
    e.g. ./Maildir/

  4. Program-feeding: |program
    e.g. |autoreply -f myoption

  5. Program-feeding + preline: |preline program
    e.g. |preline autoreply -f myoption
    preline is a program part of the qmail distribution, it provides UUCP conform header (From_ line). More info you find at dot-qmail (5).

QMail
3. QMLOCK

qmlock is a perl-program which is used with the dot-qmail-files to ensure a certain program is not used simultanously but scheduled, usually with mailing-list managers.

Usage: qmlock name command [args ...]

Use: .qmail-test:

 | preline qmlock test list-handler -f test 

It creates a file /tmp/qmlock-test for locking purposes, and makes sure 'list-handler -f test' is called only once, and all other qmail-calls (via .qmail-test) are delayed.

Switches:

-v[erbose] (verbose)
-r[etry] secs (define retry)
-t[imeout] secs (define timeout when lock should be ignored)

If you know procmail, then you obviously realize why qmlock is useful. procmail allows easy locking, and dotqm & qmlock replace some of the procmail-functionality.

We ran procmail with qmail, but since procmail can't handle Bcc: we dropped it (you have to work with Delivered-To: otherwise), and now handle all direct via qmail, with these two perl-scripts.

If you run 100+ mailing-lists and use qmlock be aware that in worst case x-times qmlock is running, each qmlock uses 500K (perl), so 100 x 0.5M are 50MB.

We will provide qmlock as C-source with preline functionally soon.

QMail
4. Other QMail Tools

QMail.Org
Main site, many add-ons are listed there
Unified Qmail Patch
Multiple useful patches merged together
qmHandle
queue statistics
qTools
other dot-qmail tools

                                                                                                                                   

MyLogger Admin LabGeoTag

Hipocrisy of the finest: "I agree that no single company can create all the hardware and software. Openness is central because it's the foundation of choice."
-- Steve Balmer (Microsoft) blaming Apple regarding iPhone, February 18, 2009

Last update 2004/03/23

All Rights Reserved - (C) 1997 - 2009 by The Labs.Com

Top of Page

The Labs.Com