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@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
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@domain.org>"
You're probably better off using envelope recipient:
envelope :is "to" "recipient@example.org"
Regards, Tom
-----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@domain.org>"
You're probably better off using envelope recipient:
envelope :is "to" "recipient@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-----
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@domain.org>"
You're probably better off using envelope recipient:
envelope :is "to" "recipient@example.org"
Regards, Tom
participants (2)
-
Tom Hendrikx
-
Yannik Sembritzki