Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using Postfix with DBMail, so Postfix delivers emails to virtual users. It has been working perfectly.

However, I want to save all emails to a local disk before delivering to virtual users. I found that content_filter can do that, but it's not a good way for me because I've already used it for spam filtering with DSpam.

Is there an another way to do that?

Thank you.

share|improve this question
Beware of the legal traps you might fall into.. – pauska Jul 15 '11 at 10:52
pauska, I'm implementing a mail archive system. – Brian Jul 16 '11 at 8:12

I've done something very similar; there seem to be a couple of different approaches.

First off, you could use recipient_bcc_maps to generate an additional address for incoming mail to that domain. This could be, for example, a table to say if the email has a recipient it should be bcc'd to archive, which is then aliased to a file/maildir.

Alternatively, the way I've done it locally is by having entries like this in my "virtual" (virtual_mailbox_maps) table: , offline-comms

and then in my "vmailbox" (virtual_mailbox_maps) table:           supply/

I then have virtual_mailbox_base set up to be the base directory of my mail archives. The entry in the "virtual" table splits the incoming email to into a delivery to offline-comms (which feeds the email to the application servers) and also to itself, so it gets looked up in "vmailbox" as well. The "vmailbox" entry tells the virtual(8) delivery agent to save the email into a Maildir called "supply" under virtual_mailbox_base.

Granted, this means having to update two files to add a new recipient. But if you were generating these files from a database, or using a database lookup, then that wouldn't really be a problem.

Note that I've aliased mail to offline-comms to get it piped to the application server. This might not work for you, depending on how you've integrated DBMail. Another way to do it is to alias incoming email into a special domain that is for archiving:,

Then have the virtual domain fed to your dbmail transport (e.g. using the transports map to simply map to dbmail-lmtp:), and the domain delivered using the virtual transport to get saved to local mail.

Hope that helps!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.