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: # Filter FROM if($E =~ /name at domain1\.tld/) { to "$M/.Friends.Name1/" } # Filter FROM with OR if($E =~ /name1 at domain1\.tld/ || $E =~ /name2 at domain2\.tld/) { to "$M/.Friends.Name2/" } # Filter Mailinglists if (/^List-Id: .*<sylpheed\.sraoss\.jp>/) { to "$M/.ML.Sylpheed/" } # Filter FROM AND SUBJECT if($E =~ /fname at domain.tld/ && /^Subject: *foooooo/) { to "$M/.foo/" } # Filter TO if (hasaddr("name at domain.tld")) { to "$M/.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/" } } $E was a shortcut for (adressmatching): ADDR=getaddr($MATCH) E=`echo $ADDR | sed 's/^M//'` $M was the path to the maildir, like /home/vmail/domain.tld/name Is that possible? Or is maildrop simple more powerful? Thank you :-) Dieter
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 at domain1\.tld/) > { > to "$M/.Friends.Name1/" > }if address :is "from" "name at domain1.tld" { fileinto "Friends.Name1"; }> # Filter FROM with OR > if($E =~ /name1 at domain1\.tld/ || $E =~ /name2 at domain2\.tld/) > { > to "$M/.Friends.Name2/" > }if anyof ( address :is "from" "name1 at domain1.tld", address :is "from" "name2 at domain2.tld") { fileinto "Friends.Name2"; } Or equivalently and much shorter: if address :is "from" ["name1 at domain1.tld","name2 at domain2.tld"] { fileinto "Friends.Name2"; }> # Filter Mailinglists > if (/^List-Id: .*<sylpheed\.sraoss\.jp>/) > { > to "$M/.ML.Sylpheed/" > }if header :contains "list-id" "sylpheed.sraoss.jp" { fileinto "ML.Sylpheed"; }> # Filter FROM AND SUBJECT > if($E =~ /fname at domain.tld/&& /^Subject: *foooooo/) > { > to "$M/.foo/" > }if allof ( address :is "from" "fname at domain.tld", /* Space between field name and value is trimmed implicitly */ header :matches "subject" "foooooo*" ) { fileinto "foo"; }> # Filter TO > if (hasaddr("name at domain.tld")) > { > to "$M/.foo/" > }if address :is :comparator "i;ascii-casemap" ["|to"|, "|cc"|,| "resent-to"|, "|resent-cc|"] ["name at 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.
Patrick Westenberg
2010-Sep-17 21:42 UTC
[Dovecot] Too stupid for sieve (former maildrop user)
Dieter Knopf schrieb:> One small issue: > My mail client (kmail) always want to open the INBOX.dovecot.sieve > (because there is a .dovecot.sieve file for the filter). (Client show > it as dovecot/sieve folder) > > Is there a way to hide this?I never had this problem because I use home directories. User specific sieve files are placed in the home directories while mails are stored in the given mail_location (can be a subdirectory of the home directory) mail_location = mdbox:~/mdbox endeavour:/var/mail/example.com/mail# ls -la insgesamt 24 drwxr-x--- 4 vmail vmail 4096 6. Sep 13:57 . drwxr-x--- 10 vmail vmail 4096 6. Sep 15:17 .. -rw------- 1 vmail vmail 452 6. Sep 13:24 .dovecot.sieve.log -rw------- 1 vmail vmail 189 6. Sep 13:25 .dovecot.svbin drwx------ 4 vmail vmail 4096 11. Sep 01:06 mdbox