Dear Dovecot / Pigeonhole community,
I have a very specific issue, but trying to solve this for a full day, I am now getting so bold from pulling my hairs out, I thought it was time I asked for help. I hope this is a good place for that.
At my hosting provider, who have been extremely helpful by the way but are not specifically skilled in Sieve, I have a catch-all address set up: *@domain.org (where * is literal), with a sieve script to control how messages are forwarded. Currently my rules are of the form:
if address :localpart :is ["To","Cc","Bcc"] ["name1", "name2", ...] { ... }
This works most of the time, but sometimes the messages are not directly addressed to me and so they slip through the filters. I figured that using envelope would solve this, so I require envelope and then do:
if envelope :localpart :is "To" ["name1", "name2", ...] { ... }
But this fails. After endlessly trying different combinations I figured out that the reason for failure is that the envelope believes the "To" is actually "*@domain.org", so it is never going to match any of the names. However, the following test succeeds:
if header :contains "Envelope-To" "name1@" { ... }
From this I deduce that a previous script has already done the conversion from name1 to *, and at the point where my sieve script is run the envelope picks up the *@domain.org address, leaving the Envelope-To header for what it is. But I am new to this.
Is that likely to be the case? Is it a common sieve set-up? And most importantly, is there a better way around the issue than testing header :contains?
With kind regards, Paul