Dovecot sieve - How to check which username a mail is being delivered to?

Tom Hendrikx tom at whyscream.net
Sat Feb 27 09:50:25 UTC 2016


Hi,

According to RFC https://tools.ietf.org/html/rfc5228#section-5.4

If one of the envelope-part strings is (case insensitive) "to", then
   matching occurs against the TO address used in the SMTP RCPT command
   that resulted in this message getting delivered to this user.  Note
   that only the most recent TO is available, and only the one relevant
   to this user.

So only the envelope recipient for the current delivery is available,
i.e. a single address.

Regards,
	Tom

On 27-02-16 10:42, Yannik Sembritzki wrote:
> 
> Hi,
> 
> what happens when an email with multiple recipient is (RCPT TO) is
> delivered over lmtp? Will 'envelope "to"' contain multiple recipients in
> this case?
> 
> 
> Am 27.02.2016 um 00:53 schrieb Tom Hendrikx:
>> On 26-02-16 21:44, Yannik Sembritzki wrote:
>>> Hi everyone,
>>>
>>> I am looking for a way to check which mailbox an email is being
>>> delivered to in a global sieve filter.
>>>
>>> After not being able to find some kind of variable that is populated by
>>> dovecot automatically, I tried to use the `Delivered-To` header.
>>> I tried a check like this:
>>>
>>>     header :is "delivered-to" "<user at domain.org>"
>>>
> 
>> You're probably better off using envelope recipient:
> 
>> envelope :is "to" "recipient at example.org"
> 
>> Regards,
>>     Tom
> 
> 
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://dovecot.org/pipermail/dovecot/attachments/20160227/16c25a0a/attachment.sig>


More information about the dovecot mailing list