summaryrefslogtreecommitdiff
path: root/alot/commands/thread.py
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2021-11-24 15:02:13 +0100
committerAnton Khirnov <anton@khirnov.net>2021-11-24 15:02:13 +0100
commit4ea9cd3cb2b56aa3bc349f327108d552ad2e2b73 (patch)
treeeb17015decb75cc9bbd51cdb9ffc1927fe5347cb /alot/commands/thread.py
parentd4884172803b8c0aa730050e9742087d8315066f (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/commands/thread.py')
-rw-r--r--alot/commands/thread.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/alot/commands/thread.py b/alot/commands/thread.py
index 5d8006a1..a2a33ef1 100644
--- a/alot/commands/thread.py
+++ b/alot/commands/thread.py
@@ -96,9 +96,10 @@ class ReplyCommand(Command):
reply.ReplyMode.AUTHOR
to, cc = reply.determine_recipients(message, account, mode)
- headers[HDR.TO] = to
+ # TODO keep those as lists?
+ headers[HDR.TO] = str(to)
if cc:
- headers[HDR.CC] = cc
+ headers[HDR.CC] = str(cc)
# set In-Reply-To + References headers
headers[HDR.IN_REPLY_TO] = '<%s>' % message.id
@@ -107,9 +108,9 @@ class ReplyCommand(Command):
# if any of the recipients is a mailinglist that we are subscribed to,
# set Mail-Followup-To header so that duplicates are avoided
# to and cc are already cleared of our own address
- mft = reply.mail_followup_to([to, cc])
+ mft = reply.mail_followup_to(to + cc)
if mft:
- headers[HDR.MAIL_FOLLOWUP_TO] = mft
+ headers[HDR.MAIL_FOLLOWUP_TO] = str(mft)
body_text = reply.body_text(message, ui)