Op 17-9-2010 10:27, Dieter Knopf schreef:
Hello,
I just migrated from Postfix/Courier/Maildrop to Postfix/Dovecot/Deliver/Sieve and don't unterstand the right syntax for sieve :( I searched and found many small examples and many links to the RFC, but nothing was usefull for me (or i didn't unterstand it)
I installed the latest Dovecot-Sieve (hg).
Examples from my maildrop config:
I've never used maildrop before, but using its docs and some guesswork I'll give it a go. The mentioned folder names may depend on your namespace config, particularly in terms of a INBOX prefix; use whatever is used in IMAP. The scripts below are a little more verbose than necessary, as I always explicitly list the :is match type.
require "fileinto"; require "subaddress"; /* for the :domain part (last script) */
# Filter FROM if($E =~ /name@domain1\.tld/) { to "$M/.Friends.Name1/" }
if address :is "from" "name@domain1.tld" { fileinto "Friends.Name1"; }
# Filter FROM with OR if($E =~ /name1@domain1\.tld/ || $E =~ /name2@domain2\.tld/) { to "$M/.Friends.Name2/" }
if anyof ( address :is "from" "name1@domain1.tld", address :is "from" "name2@domain2.tld") { fileinto "Friends.Name2"; }
Or equivalently and much shorter:
if address :is "from" ["name1@domain1.tld","name2@domain2.tld"] { fileinto "Friends.Name2"; }
# Filter Mailinglists if (/^List-Id: .*
/) { to "$M/.ML.Sylpheed/" }
if header :contains "list-id" "sylpheed.sraoss.jp" { fileinto "ML.Sylpheed"; }
# Filter FROM AND SUBJECT if($E =~ /fname@domain.tld/&& /^Subject: *foooooo/) { to "$M/.foo/" }
if allof ( address :is "from" "fname@domain.tld", /* Space between field name and value is trimmed implicitly */ header :matches "subject" "foooooo*" ) { fileinto "foo"; }
# Filter TO if (hasaddr("name@domain.tld")) { to "$M/.foo/" }
if address :is :comparator "i;ascii-casemap" ["|to"|, "|cc"|,| "resent-to"|, "|resent-cc|"] ["name@domain.tld"] { fileinto "foo"; }
# Or something like this: if($E =~ /.*@facebookmail\.com/) { if (/^Subject: .*invited you to join the group/) { to "$M/.Facebook.Invites.Groups/" } if (/^Subject: .*invited you to the event/) { to "$M/.Facebook.Invites.Events/" } }
if address :is :domain "from" "facebookmail.com" { if header :matches "subject" "invited you to join the group*" { fileinto "Facebook.Invites.Groups"; } elseif header :matches "subject" "invited you to the event*" { fileinto "Facebook.Invites.Events"; } }
Is that possible? Yes, given the above examples.
Or is maildrop simple more powerful?
Maildrop is more powerful, particularly because it can execute arbitrary binaries. For security reasons, Sieve doesn't support that at all. But, since you are not using such functionality, your migration should be problem-free.
Thank you :-)
PS: The above scripts were produced in an ad-hoc fashion. I haven bothered to do syntax checking.
Regards,
Stephan.