Posted by: Anthony Drewery | August 4, 2006

Using Qmail as a store and forward service

I have a stake in a London based fire protection company and sometimes get involved with their IT. Being a small company they run MS Small Business Server 2003 and connect to the internet using ADSL and a fixed IP address. For their email the MX reccord points to their internal server via a port mapping on their firewall. I also wanted to give them a secondary MX record with a store and forward service in case their server or Internet connection is down for a prolonged period. I looked at various commercial services but eventually decided to make use of their dedicated web server hosted by their ISP. The server runs Fedora Core and includes Qmail as part of the build.

I’m far from being skilled in Linux/Qmail but I can stumble my way through when necessary. There’s a plethora of resource material on the Internet and I use a little Unix and Sendmail at work. Dave Sill has produced the excellent Life With Qmail guide that will get you started with Qmail.

Firstly you’ll need an SSH client. I use PuTTY. Once logged in to your server navigate to /var/qmail/control.

Next vi the rcpthosts file. (I’m sure there are other editors but I learnt the basics of vi back at university on VAX/VMS systems so stick with what I know.) Add to the file the domain you want to store and forward for e.g. Save your changes and exit.

Now vi the smtproutes file. Here you need to add the SMTP domain and destination host in the following format SMTPdomainname:FQDNofdestinationhost e.g. Save and exit.

And that’s all there is to it.

You can’t adjust the delivery retry intervals in Qmail but it will keep the messages for 1 week before expiring. This is longer than the defaults for some other messaging systems (Exchange 2003 defaults to 48 hours, MIMEsweeper is 72 hours) and therefore ideal for a store and forward service.

With some slight further configuration it should also be possible to access the stored email via a web interface which would be useful in a DR scenario. This is on my to-do list and I’ll blog the process once done.



  1. Life with qmail is great, I often find myself refering to it.

    If your webhost is already running MySQL or PostgreSQL, for a temporary web access solution I can definitely recommend roundcube webmail.


  2. You can adjust the time that qmail will store messages in the queue before bouncing them.

    Create the file:

    The only thing in this file should be the number of seconds you want messgages in the queue before they are bounced.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: