diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2012-01-17 11:18:32 +0000 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2012-01-17 11:19:18 +0000 |
commit | fb5df0877417f04059856f0ce796e263382d18f1 (patch) | |
tree | bd4c94c6f30e39029badeab544fe984642cd54a6 | |
parent | dd957d0630ce9eb2f0245706901eaa0bf5401e28 (diff) |
smarter recipient detection for reply
- respect reply-to header
- do not copy the content of the Bcc header
when group-replying: it will be empty anyway!
- if value of reply-to and from differ add both
to the recipient list
issue #246
-rw-r--r-- | alot/commands/thread.py | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/alot/commands/thread.py b/alot/commands/thread.py index b13d8ea5..16917110 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -82,24 +82,22 @@ class ReplyCommand(Command): envelope.add('From', fromstring) # set To + sender = mail['Reply-To'] or mail['From'] + recipients = [sender] if self.groupreply: + if sender != mail['From']: + recipients.append(mail['From']) cleared = self.clear_my_address(my_addresses, mail.get('To', '')) - if cleared: - logging.info(mail['From'] + ', ' + cleared) - to = mail['From'] + ', ' + cleared - envelope.add('To', decode_header(to)) + recipients.append(cleared) - else: - envelope.add('To', decode_header(mail['From'])) - # copy cc and bcc for group-replies + # copy cc for group-replies if 'Cc' in mail: cc = self.clear_my_address(my_addresses, mail['Cc']) envelope.add('Cc', decode_header(cc)) - if 'Bcc' in mail: - bcc = self.clear_my_address(my_addresses, mail['Bcc']) - envelope.add('Bcc', decode_header(bcc)) - else: - envelope.add('To', decode_header(mail['From'])) + + to = ', '.join(recipients) + logging.debug('reply to: %s' % to) + envelope.add('To', decode_header(to)) # set In-Reply-To header envelope.add('In-Reply-To', '<%s>' % self.message.get_message_id()) |