[Dovecot] Writing "sieve" script

Jerry dovecot.user at seibercom.net
Tue Mar 23 23:02:33 EET 2010

This is probably not the best place to ask this question; however, I
figured I had to start somewhere.

I want to write a sieve script that can sort incoming mail into
specific locations.


require ["fileinto"];
if header :contains "X-Virus-Status" "Infected" {fileinto "SPAM"; stop;}
elsif header :contains "X-SpamCop-Disposition" "Blocked" {fileinto "SPAM"; stop;}
elsif address :contains "To" "user1 at domain.com" {fileinto "INBOX.user1";}
elsif address :contains "To" "user2 at domain.com" {fileinto "INBOX.user2";}
elsif address :contains "To" "user3 at domain.com" {fileinto "INBOX.user3";}
# The rest goes into INBOX
# The default is "implicit keep", we do it here explicitly
else {keep;}

This works fine unless user1, user2 and or user3 are all included in
the same e-mail address. It is rare; however, it does happen. In that
case, a separate message for each recipient would be delivered to the
first matching mailbox. The other recipients would not receive any traffic at all.

I am new at writing sieve scripts, and have not come up with any way of
preventing this from happening. If anyone has a suggestion, I would
love to hear it. Even the examples I found by Googling were not really informative.

Dovecot.user at seibercom.net

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the Reply-To header.

"Glory is fleeting, but obscurity is forever." - Napoleon Bonaparte

More information about the dovecot mailing list