From 4ea9cd3cb2b56aa3bc349f327108d552ad2e2b73 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 24 Nov 2021 15:02:13 +0100 Subject: 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 + ). --- alot/mail/policy.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'alot/mail/policy.py') 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(): -- cgit v1.2.3