Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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 foo@ourdomain.example.com 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:

supply@emails.example.com           supply@emails.example.com, offline-comms

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

supply@emails.example.com           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 supply@emails.example.com 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:

supply@emails.example.com   supply@emails.example.com, supply@archive.example.com

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

Hope that helps!

share|improve this answer

Your Answer

 
discard

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.