Skip to content

Commit

Permalink
Merge pull request #24 from chadgates/mdn_originator
Browse files Browse the repository at this point in the history
If no Original-Recipient provided, fall back to mandatory Final-Recip…
  • Loading branch information
abhishek-ram authored Oct 23, 2020
2 parents b4e65f4 + 24b01bb commit c09648b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pyas2lib/as2.py
Original file line number Diff line number Diff line change
Expand Up @@ -978,5 +978,8 @@ def detect_mdn(self):
if part.get_content_type() == "message/disposition-notification":
mdn = part.get_payload()[0]
message_id = mdn.get("Original-Message-ID").strip("<>")
message_recipient = mdn.get("Original-Recipient").split(";")[1].strip()
if mdn.get("Original-Recipient"):
message_recipient = mdn.get("Original-Recipient").split(";")[1].strip()
else:
message_recipient = mdn.get("Final-Recipient").split(";")[1].strip()
return message_id, message_recipient

0 comments on commit c09648b

Please sign in to comment.