Tag Archives: archive

Qmail Taps Extended

Problem

You're running qmail and you want to log as in "copy/archive/tap"  only the outgoing email messages.  Inter7, the creators of vpopmail have a nice solution in a patch named qmailtap.

This patch will actually give you the option to match a message's To and From addresses against a regexp and decide what to do with them, all in an easy to write configuration file but this solution will not differentiate between To and From so if any of them matches the regexp the messages will be copied.

If you would only want to log outgoing mail you could decide to log only the messages which have the From address set to a local account but since there's no way to know which of the From or To addresses  matched you can't do this.

Solution

I created another patch that would allow you to specify which address you want to match.

With the original patch to match everything To or From @domain.com and copy to copy@example.com  you would need a line like this in the configuration:

.*@domain.com:copy@example.com

With the new patch if you only want to log the messages with the From address @domain.com you would set the configuration like this:

F:.*@domain.com:copy@example.com

If you want to log only those with the To address @domain.com

T:.*@domain.com:copy@example.com

if you want the same behavior as the original patch:

A:.*@domain.com:copy@example.com

Note: When writing multiple rules you have to consider how qmail-queue works after this patch
For each message qmail-queue looks at the From address first and tries to match it against the lines
starting with F: or A:.   When it finds a match it copies the message and stops.
If it didn't find a match in the F: or A: lines  it will try to match the To address against
the T: and A: lines.

Download

If you have not applied qmailtap patch yet here is the new full patch:

[download#3]

If you have already applied the qmailtap patch here is a patch you have to apply to obtain the new functionality:

[download#4]

Got any questions ? Or maybe you have other solutions... hit the comments!