diff options
author | Anton Khirnov <anton@khirnov.net> | 2021-11-24 15:02:13 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2021-11-24 15:02:13 +0100 |
commit | 4ea9cd3cb2b56aa3bc349f327108d552ad2e2b73 (patch) | |
tree | eb17015decb75cc9bbd51cdb9ffc1927fe5347cb /alot/mail/policy.py | |
parent | d4884172803b8c0aa730050e9742087d8315066f (diff) |
mail/reply: rewrite recipient selection
Thoroughly ensure that To+Cc contains neither our own address (except
when it is wanted) nor any duplicates.
Use structured headers provided by email.headerregistry to simplify
dealing with addr-spec vs. mailbox (display name + <addr-spec>).
Diffstat (limited to 'alot/mail/policy.py')
-rw-r--r-- | alot/mail/policy.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/alot/mail/policy.py b/alot/mail/policy.py index 1b9f07c3..6125f8f7 100644 --- a/alot/mail/policy.py +++ b/alot/mail/policy.py @@ -6,13 +6,17 @@ import email.headerregistry as _hdr from . import headers as HDR +# here we define our custom policy that handles additional headers + _headers = { - HDR.X_BEEN_THERE : _hdr.UniqueAddressHeader, - HDR.X_MAILING_LIST : _hdr.UniqueAddressHeader, + HDR.X_BEEN_THERE : _hdr.UniqueAddressHeader, + HDR.X_MAILING_LIST : _hdr.UniqueAddressHeader, + HDR.MAIL_FOLLOWUP_TO : _hdr.UniqueAddressHeader, + HDR.MAIL_REPLY_TO : _hdr.UniqueAddressHeader, } -# here we define our custom policy that handles additional headers -# derive from SMTP +# derive from SMTP, but create a new instance to get our own +# instance of header_factory p = _p.EmailPolicy() + _p.SMTP for h, t in _headers.items(): |