summaryrefslogtreecommitdiff
path: root/src/leap/mx
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2015-04-13 15:58:16 -0300
committerdrebs <drebs@leap.se>2015-04-13 16:32:52 -0300
commit14ef3dcce18240b756415fefa2a56936f96a12e9 (patch)
tree24ce93b023200611555aacf8d98feb78d9e8c21c /src/leap/mx
parentb0ef529cc882a96903597fb5279919969fa286c3 (diff)
[bug] fix bounce message recipient
The bounce message was using the original message's "From:" header instead of the "To:" header to indicate the original recipient. This commit fixes that. Closes: #6854. Releases: 0.6.2, 0.7.0
Diffstat (limited to 'src/leap/mx')
-rw-r--r--src/leap/mx/mail_receiver.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/leap/mx/mail_receiver.py b/src/leap/mx/mail_receiver.py
index 7856594..77909b0 100644
--- a/src/leap/mx/mail_receiver.py
+++ b/src/leap/mx/mail_receiver.py
@@ -392,15 +392,16 @@ class MailReceiver(Service):
:param reason: Brief explanation about why it's being bounced
:type reason: str
"""
- to = orig_msg.get("From")
+ orig_from = orig_msg.get("From")
+ orig_to = orig_msg.get("To")
msg = MIMEMultipart()
msg['From'] = self._bounce_from
- msg['To'] = to
+ msg['To'] = orig_from
msg['Date'] = formatdate(localtime=True)
msg['Subject'] = self._bounce_subject
- decoded_to = " ".join([x[0] for x in decode_header(to)])
+ decoded_to = " ".join([x[0] for x in decode_header(orig_to)])
text = BOUNCE_TEMPLATE.format(decoded_to,
reason,
orig_msg.as_string())