On 19/07/2020 12:58, @lbutlr wrote:
On 18 Jul 2020, at 11:23, Stephan Bosch <step...@rename-it.nl> wrote:
On 12/07/2020 22:47, @lbutlr wrote:
On 12 Jul 2020, at 10:17, Benny Pedersen <m...@junc.eu> wrote:
@lbutlr skrev den 2020-07-12 16:43:
I an trying to write a sieve action that will take mail that is
addressed to a user only it is filed in a mailbox (e.g. "Direct") if
it is to the email AND to any other email address, then file it in a
mailbox named, e.g. "Cc". And if the mail is not addressed to the user
at all, sieve does nothing with it.
Message 1: to f...@example.com => Direct
Message 2: to/cc f...@example.com & to/cc to
        any...@anydomain.tlf => CC
   Optional: If it contains a specific header like
        "X-bypass: secret string" => no action
Message 3: NOT to/cc f...@example.com => no action
I've gotten exactly nowhere so far
Something like
if :allof (header :contains ["to"] ["foo#example.com"],
        header :contains ["cc"] ["foo#example.com"])
Takes care of the first part of the message 1 and 2 criteria. But then what?
to, cc can be one single header test

https://p5r.uk/blog/2011/sieve-tutorial.html

allof will force all headers to match, and thus it will not always work if foo 
is not in both

will this solve it ?
That is helpful, but I still do not see how to test for "email has anndress other 
than this address". If I simply say the address does not contain the address, then 
to will not match any mail that is sent to both f...@ewxample.com AND to another unknown 
email.
Maybe you could use the ":count" match from the "relational" extension to check 
whether more than one address is contained in a header field when the recipient address is already 
present. This doesn't address the weird situation where the recipient address is listed more than 
once though.
I'll look into that, thanks. (I don't often see doubled email addresses, in 
fact not sure I ever have, so that may be an edge case I can safely ignore).

This is what I have right now for testing. I assume there is at least on syntax 
error in here 😃

if address :is :localpart ["to", "cc"] "kremels" {
         if allof (address :count "ge" :comperator "i:ascii-numeric" ["to", 
"cc"] 2,
                 (not exists ["list-id","mailing-list" "x-loop"] )
         {
                 fileinto :create "listCC"
         }
}

So as I read this, if the list address is not in to or cc, then abort, 
otherwise, check if there is more than one address specified, AND there are no 
list headers, file it in a specific mailbox.

Not exactly what I want to do eventually, but enough for testing at this point.

Looks OK. Needs to be "2" though (argument is always string/string-list).

Regards,

Stephan.

Reply via email to