Hello, after qmail migration need convert some .procmailrc scripts. Found converter procmail -> sieve, but i'm not sure of quality of conversion. My script: --------------- if header :contains "from" ["user at domain1.tld", "user2 at domain2.tld", "user3 at domain3.tld"] { redirect "foo1 at bar.tld"; redirect "foo2 at bar.tld"; .... redirect "foo20 at bar.tld"; } else { keep; } --------------- Converter script: --------------- require ["fileinto","regex","envelope","vacation"]; if envelope :comparator "i;octet" :contains "From.*(user at domain1.tld|user2 at domain2.tld|user3 at domain3.tld)" "" { redirect "foo1 at bar.tld foo2 at bar.tld .... foo20 at bar.tld"; } if true { fileinto "$DEFAULT"; } --------------- Converter script is cannot be compiled. But it used other style envelope. So what is difference between envelope and header ? And there are some limits for redirect ? Thank you. -- Lampa
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Fri, 29 Jan 2010, Lampa wrote:> My script: > --------------- > if header :contains "from" ["user at domain1.tld", "user2 at domain2.tld", > "user3 at domain3.tld"] { > redirect "foo1 at bar.tld"; > redirect "foo2 at bar.tld"; > .... > redirect "foo20 at bar.tld"; > } else { > keep; > }either add "stop;" after redirects or remove the else branch, because after the redirects you'll have the implict "keep", as far as I know.> require ["fileinto","regex","envelope","vacation"]; > > if envelope :comparator "i;octet" :contains > "From.*(user at domain1.tld|user2 at domain2.tld|user3 at domain3.tld)" "" {I would expect: "From" "(user ....)" { http://ietfreport.isoc.org/rfc/rfc5228.txt sec 5.4> redirect "foo1 at bar.tld foo2 at bar.tld .... foo20 at bar.tld";The RFC uses singular with the "redirect" argument, hence, I suppose, it is implementor-defined, whether or not the space-delimited recipients will work.> if true { > fileinto "$DEFAULT";There is no $DEFAULT, IMHO.> Converter script is cannot be compiled. But it used other style envelope.What's the error?> So what is difference between envelope and header ?"header" compares the values in the mail itself, e.g. "From", "To", but "Subject", "X-Scanned", too. "envelope" compares values of the SMTP-phase commands, "From" corresponds to the "MAIL FROM" SMTP command and "To" to the "Rcpt to" command. The availability of those envelope information differs among the MTAs, some do not provide "MAIL FROM" at all, some do provide all "RCPT TO"s, some only the "RCPT TO" of the particular recipient, some only if there is exactly one recipient. Therefore the RFC states that implemenations SHOULD have "envelope". It is no requirement. Regards, - -- Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iQEVAwUBS2Lx6b+Vh58GPL/cAQL5zwgAwnm7iOhl2rgdnw8a3lVCP0j9nnLW/rKF IJ4GNbgCUyr+fLdixYL8TJt0kxq5pvjdviW/wII96Phqaom0iQi/GCC0fg0aKSqJ SXsDP12nfcgENsg8DgXNBMtPVzSUHMRL04EDB9Jox+P1ulxhsKVholKHVwObdbew BoEt04YmRtvWNJYF1rNM6fDxIV9FeA1w9FMeO6XSsWbY2jHY42NdJAtQibL36DbO KyCDH207Ykzc+GZi0n8jeJGyIC1ZvH+DT0pXVE1jj1gslOjsBKDLrJ+jIJfMDJfZ HEYPXxxkvTR/QQn1OBJKlOGYGO2d67/roqIYbArsIcxr6KRDJ95vNw==FLGC -----END PGP SIGNATURE-----
Lampa wrote:> Hello, > > after qmail migration need convert some .procmailrc scripts. Found > converter procmail -> sieve, but i'm not sure of quality of > conversion. > > My script: > --------------- > if header :contains "from" ["user at domain1.tld", "user2 at domain2.tld", > "user3 at domain3.tld"] { > redirect "foo1 at bar.tld"; > redirect "foo2 at bar.tld"; > .... > redirect "foo20 at bar.tld"; > } else { > keep; > } > --------------- > > Converter script: > --------------- > require ["fileinto","regex","envelope","vacation"]; > > if envelope :comparator "i;octet" :contains > "From.*(user at domain1.tld|user2 at domain2.tld|user3 at domain3.tld)" "" { > redirect "foo1 at bar.tld foo2 at bar.tld .... foo20 at bar.tld"; > } > > if true { > fileinto "$DEFAULT"; > }This not Sieve. There is no envelope part "From.*(... " and redirect only accepts one address.> --------------- > > Converter script is cannot be compiled. But it used other style envelope. >The converter's script does not make much sense, although I can see what it is trying to do.> So what is difference between envelope and header ?The header test matches against headers of the message itself. The envelope test matches against the SMTP envelope.> And there are some limits for redirect ?Check the 'Configurable Limits' section of the INSTALL file (wiki needs to be updated): http://hg.rename-it.nl/dovecot-1.2-sieve/file/0.1.15/INSTALL So, you can configure sieve_max_redirects according to your needs. Regards, Stephan.