Yannik Sembritzki
2016-Feb-26 20:44 UTC
Dovecot sieve - How to check which username a mail is being delivered to?
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>" Unfortunately, this does not only match the first occurence of the header (which can be assumed is added by dovecot), but any occurence of this header in the email, which could be added due to previous deliveries and forwards, or just cause of malice. Is there any way to achieve this? Best regards, Yannik
Tom Hendrikx
2016-Feb-26 23:53 UTC
Dovecot sieve - How to check which username a mail is being delivered to?
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/aa54fc5a/attachment.sig>
Yannik Sembritzki
2016-Feb-27 09:42 UTC
Dovecot sieve - How to check which username a mail is being delivered to?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 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 >-----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJW0W9vAAoJECmWCr2wpSDlu0MQAMAuSTcNEVoxuHySwsuTzqs6 pHcrTUaI9fTmooSkwAFwExUwXBgttXnEhqa+C2wgsyMDUXGki59xAwvSbREzBwL3 84uLguNSS0nC+wh1bGNK2W+jOHq9VPxcVMT/T9agsDJJfB7I5sBfebawOCUrE7c0 8J4lXv1X5xnC7FzJ9aZ9ufd65Tb2N7j3a3QezQwgj5IC69rdp7dM1Uhg+25jlvIr 8l9C8Gc7j3FszbAWFKpvKH2kSnAskYCWvMJ/zCUmf7Z5yd0KfhSAi2qWU4X1Q4oV NAANEIUeg6wG/QxcED3N7+1pucp4X9+Kk/oTNYSh/1y0MxeiBIyOpF2CPOk9hiU5 6jswa5qc73I6lP5EcaTxW9NCcrZRxiosKTrW2j9dKbS/WywmkwXF+F8Ziy7SZG+H 0DlKNdjUnKffe7WdvqRf4cYdBOwkwPql5c0w8qj8obMZdl8X5QxErlgYH7Ugmzmp qVg3XjPT1cGmh5CP+l2sN52Dm0EHvPvyYPhLLB0qJXQsQ7lTrnJqFxZypxtnnNwR wCfpzu2WiaawIPZAK3TpOY6+gKXhOOMEeppVPyXmH/YiTdNuETJ2bawfFfq3YXm6 3A+vOBF72Oem9t2YKAf3N4zJFaEK2WmYIBm3WKrUEcX6bnhzJ/QYx9hAFOYwVWqc CgPSSBIFTxtEMWM1rHsw =/Vno -----END PGP SIGNATURE-----