Postfix, maildir's, and writing filters

George Fazio gfazio at
Tue Sep 23 01:06:10 UTC 2008

Da Rock wrote:
> Howdy. This may seem simple, but I'm completely green on this: I have a
> postfix server with a courier-imap client frontend using maildir's. I'm
> using imap for an internal mta, but I need to setup a system which
> retains copies of sent emails on the network and not on individual
> workstations (which is what happens currently).
When you say courier-imap client, do you mean you're using maildrop to 
deliver the message to the user's maildir or that there is an end-user 
courier-imap client?  I am only familiar with the maildrop piece of courier.
> I've looked at some of the solutions (bcc and send to a psuedo account
> for each user, bcc to the user and filter the incoming mail on this) but
> it seems like a very roundabout way of doing things. I've read up on
> Postfix, and there is support for custom filters, so:
> 1. what does it take to write one?
> 2. how does one copy email from one folder to another in maildirs? Is it
> possible?
This is a classic case of over engineering.  You do not want to bcc back 
to the user, or filter the mta, just move the outgoing messages to the 
sent folder.  You might need bcc for the purposes of journaling all 
email, if you have any legal requirement (sox, hippa, etc.) that require 
it.  But, that it another ball of wax entirely.
> This idea I have should filter the outgoing mail and copy the messages
> to the sent folder as well as retaining its place in the queue.
If the end-user's client is using imap and configured properly, it 
should do this for you.  Thurderbird, the full version of Outlook (and 
probably Express), and many other clients support this natively - you 
just have to make sure the client is configured to do that.  Typically, 
in the configuration of the client, there is something that says 
something like "save a copy of sent messages to <folder of choice>".  I 
don't know what client you're using.  I use Pine/Alpine, Thunderbird, 
and Outlook (when I have no other choice).

If the end-user's client is using pop, then you have a problem that may 
require a custom solution like you speak of above.
> Any ideas? Maybe a link to some good info? I would like to know how to
> do this myself so I can do more in the future so info and pointers would
> be great (if you have a script you'd like to share then please show me
> how it works :) ).
> Cheers

My mail system is running postfix (mta) w/ dovecot (for imap or pop 
access from the clients), maildrop (for delivering to a maildir), and 
amavis-new (for spam filtering and virus scanning w/ clamav).  My mail 
clients are configured for imap, and they save copies of sent mail to 
the sent folder as expected.  While I am using dovecot, and not courier, 
for my imap server - I cannot imagine that any other imap server would 
handle things any differently ... it's core functionality that ever imap 
server should have imho.


More information about the freebsd-questions mailing list