fastforward-idx: qmail-local features and per-user alias files for fastforward

David Harris, dharris@

Posted June 15, 1999.

Quick Summary
Fastforward-idx is patch to the qmail accessory program fastforward, which is designed to replace .qmail files for per-user mail configuration with one alias file triggered from .qmail-default. To replace the .qmail files, all of the functionality of qmail-local has been added into fastforward, such as "-default" wildcarding, maildir/mailfile delivery, setting specific environment variables for subprograms, etc. Also, the hardcoded reference in newaliases to /etc/aliases was removed, so each user can have their own alias file.

Available for consulting work

I am currently available for consulting work. For consulting, I am happy to telecommute or come to your site for a period of time.

For more information about my skills and experience, view my statement of consulting capabilities or contact me for more information.

Back to home.

1. Description

The author of qmail also created a package called fastforward which implements industrial-strength email forwarding storing the instructions in a hashed file for quick access.

I run a virtual hosting server setup and wanted to give all of my users their own fastforward alias file, with the fastforward program being run from their .qmail-default file. This required a minor patch to allow newaliases to work on files other than /etc/alises, to which it was hardcoded.

However, there was still a problem: If I wanted to setup a listserv for one of the users, fastforward didn't have the functionality to specify that, so I had to place the instructions in .qmail files. Likewise with vacation programs or auto-responders, etc.

IMO, it is simply messy to have the configuration for the e-mail forwarding was in two places like this. Not very nice for the automatic administration tools that will manage the e-mail forwarding. Also for each list-serv four or five .qmail files were created, cluttering up the user's home directory.

So, I patched fastforward to include all the functionality of qmail-local (the program that implements .qmail files). With this patch, anything that you could do with .qmail files, you can now do with fastforward.

The following changes were made and features were added to fastforward:

  • Fastforward can now deliver to mbox files and mail directories. Just use the :file:./Maildir/ or :file:./Mailbox syntax as a target.

  • Wildcard matching in the form -default was added. The DEFAULT environment variable is properly set for subprograms. See the dot-qmail man page "Extension Addresses" section.

  • Enveloe sender address rewriting in the form -owner and -owner-default is done. The NEWSENDER environment variable is properly set for subprograms. Also see the dot-qmail man page "Extension Addresses" section.

  • The internal workings of fastforward's old form of sender address rewriting in the form owner- was improved slightly. It now behaves more like qmail-local.

  • Aliases match in the order user@domain, then user@, then @domain instead of the previous user@domain, @domain, then user@. I made this change to think more along the lines of one domain, where a user@ is more specific (potential to match less) than @domain.

  • Fastforward would run preline to add delivery lines to the mail header when running subprograms. This has been removed to come into qmail-local compliance. However, if you still want preline, just use two vertical bars instead of one to specify program delivery.

  • When running delivery programs the return value of 99 is now honored. It specifies that delivery should be stopped and marked as successful.

  • Previously, fastforward ran delivery programs in the reverse order from what was specified. This was simply a byproduct of the way the commands were stored internally. With this patch, they execute in the same order as specified.

  • Previsouly, fastforward would recursively expanded aliases. This caused way too many complications when things were extended, so that functionality was simply removed.

I've done a descent job of documenting the feature additions and configuration format changes in the newaliases man page.

2. Example

As an example, we have a user named foo which has aliased to them using the control/virtualdomains file. In their .qmail-default file we place:
    | fastforward .domains.cdb
And in the .domains file we have:
    # .domains - controls e-mail forwarding
    # mbox delivery :
    # maildir delivery :
    # autoresponder :
        "|echo $SENDER >>sales_prospects"
        "|qmail-inject -f \"\" \"$SENDER\" < sales_response"
    # a list of friends, with bounce messages handled : foo :
        Friend one <>
        Another Guy <>
        Friend Three <>
    # default goes to user : foo
Then run "newaliases .domains" to make the .domains.cdb hashed file and have fun forwarding e-mail. You can even place list-serves in the .domains file if you want!

3. Distribution & Installation

Current version: 1.01, released June 15, 1999.

Here is the patch to fastforward version 0.51:

Also, here is test setup that I used to prove to myself that this fastforward-idx really worked the same as qmail-local: This is provided under GPL license.