Maybe you can do it with postdrop?
On 14 Nov 2013 20:18, "Yanko Hernández Álvarez" <[email protected]> wrote: > > Hello: > > I'm loosing my mind trying to classify my outgoing messages with > sieve-test (2.0.9, centos 6.4). It came to the point I think it's not > even possible with a sieve script. > > I need to classify my outgoing messages in three folders: > > 1- To my department (@dept.example.com) > 2- To my company (@example.com, @anyotherdept.example.com) > (anyotherdept.example.com as in a way to say "any other domain that > ends with 'example.com', but not 'dept.example.com'") > 3- To the rest of the word (@any.other.domain) > > The problematic requirement is I need to make a copy in EVERY IMAP > folder that applies. For instance: for an email such as > ---- > From: [email protected] > To: [email protected], [email protected], [email protected] > ... > ---- > I need to make a copy to all folders: Dept (because of > [email protected]), Company (because of [email protected]) and Rest > (because of [email protected]). > > Rule for #1 is simple: > ----- > if address :matches :domain "To" "dept.example.com" { fileinto: "Dept"; } > ----- > > Rule for #2, I don't know how to declare it: I don't know how to make > a rule that matches "example.com" (or anyotherdept.example.com) and > not "dept.example.com". > > if allof(address :matches :domain "To" "example.com", not address > :matches :domain "To" "dept.example.com") { fileinto: "Company"; } > ... doesn't work, because [email protected] matches (address > :matches :domain "To" "example.com"), but it doesn't matches (not > address :matches :domain "To" "dept.example.com"). > > "[email protected]" matches both conditions, but sieve-test stops on > the first email address with a "not matches" > > As for Rule #3: I don't know how to do it either, it should be the > same as Rule #2, (with different parameters of course). > > A sieve script should be capable to do this, but it seems that I'm > loosing something. Does any one knows how to do this? > > Kind regards > Yanko > > PS: English is not my native language. Please forgive me any > mistakes/misspellings/etc I made.
