[Dovecot] Sieve script problem (don't know if is it possible to do this)

Muzaffer Tolga Ozses tolga at ozses.net
Thu Nov 14 21:53:34 EET 2013


Maybe you can do it with postdrop?

On 14 Nov 2013 20:18, "Yanko Hernández Álvarez" <yhdezalvarez at gmail.com>
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: myuser at dept.example.com
> To: user at dept.example.com, user at example.com, user at other.domain
> ...
> ----
> I need to make a copy to all folders: Dept (because of
> user at dept.example.com), Company (because of user at example.com) and Rest
> (because of user at other.domain).
>
> 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 user at dept.example.com matches (address
> :matches :domain "To" "example.com"), but it doesn't matches (not
> address :matches :domain "To" "dept.example.com").
>
> "user at example.com" 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.


More information about the dovecot mailing list