[Dovecot] Sieve - BCC

Ben Morrow ben at morrow.me.uk
Sun Apr 21 11:57:40 EEST 2013


At 12AM -0700 on 21/04/13 you (iliusha) wrote:
> 
> Can you help me please with sieve plugin for dovecot
> 
> I have this rule:
> 
> /require ["variables", "envelope", "fileinto", "subaddress", "imap4flags"];
> if anyof
>     (
>         address :is [ "to", "cc", "bcc" ] "test at example.com",
>         envelope :contains "to" "test at example.com"
> 
>         )
>     {
> 
>     fileinto "Test";
>     stop;
> }/
> 
> and if somebody sends me an email with "test at example.com" in "TO" or "CC" -
> then sieve works properly and put this email in Test folder, but i can't
> understand why if it sends e-mail to "test at example.com" in BCC - sieve don't
> move it to Test but leave it in Inbox? 

You can't. The whole point of Bcc is that the sending SMTP server
removes the header before the mail is sent, so that the other recipients
can't see someone was CCed. 

Filtering on the envelope recipient address ought to be sufficient,
unless that address is getting rewritten somewhere in the mail path.

> If i run sieve-test -faD .dovecot.sieve "Message-ID" i get:
> 
> /Performed actions:
> 
>  * store message in folder: Test
> 
> Implicit keep:
> 
>   (none)
> 
> sieve-test(root): Info: final result: success/
> 
> but in dovecot log i get:
> /Info: sieve: msgid=<20130421074437.570EA2BA1C1F at mail.com>: stored mail into
> mailbox 'INBOX'/
> and email is going to Inbox folder, instead Test. 

I'm not sure exactly what you're doing here, but if you're passing
sieve-test a mail that does actually have a Bcc line with your address
in, I would expect it to work. The problem is that ordinary incoming
mail won't have that line.

Ben



More information about the dovecot mailing list