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 recieve mail from a server where I can specify one .forward mail where all mails get forwarded to. However, those mails have different senders, and one of them is important contact mail while the other is log mail. What I want to achieve is filter these messages and send them to two different domains.

In psuedo code:

if from == LOG_SENDER:

Note that the original mal comes from outside my configuration reach. My current solution is having manual filters in thunderbird that just drop the logs in a seperate folder. But I would like to have the filtering as early as possible.

Is this possible with postfix?

My current setup is Postfix & Dovecot with SASL auth.

share|improve this question
Have you looked at dovecot and sieve? – NickW Mar 22 '13 at 17:51
+1 for sieve suggestion – Alex P. Mar 23 '13 at 3:55
@NickW Could you create answer based on your comment? – Andrzej A. Filip Mar 23 '13 at 20:15
I'm not sure how to do it with Sieve, but if can be easily done with procmail(1) iff that's used as MDA – abbe Mar 24 '13 at 15:29
@AndrzejA.Filip: I have added my own answer. – javex Mar 24 '13 at 22:35
up vote 0 down vote accepted

Okay, since @NickW seems to unavailable, I will explain what I did based on his suggestion: I used sieve (already using dovecot 2) to create the filter I needed.

I actually moved from forwarding to sorting into a specific folder but alterting that in case I ever need something different is easy.

In the protocol lda section I add a line to active Sieve:

protocol lda {
  mail_plugins = $mail_plugins sieve

Then set the path for sieve scripts:

plugin {
    sieve = /etc/dovecot/sieve-scripts/%u.sieve

And the final script for my user:

require ["fileinto"];

if address :is "from" "" {
    fileinto "Logs";

With these settings, all my mail gets sent into the Logs folder if it is from Very easy to set up once you figured out how to activate sieve (I find the documentation on that a bit lacking).

share|improve this answer
Sorry, on the weekends I'm usually nowhere near a computer ;) Glad you got it going! – NickW Mar 25 '13 at 9:22

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.