From 24b01bbcd8d01b9cca663f8366dcdb9d369b3952 Mon Sep 17 00:00:00 2001 From: Wassilios Lytras Date: Wed, 21 Oct 2020 12:55:58 +0200 Subject: [PATCH] If no Original-Recipient provided, fall back to mandatory Final-Recipient. --- pyas2lib/as2.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyas2lib/as2.py b/pyas2lib/as2.py index a89f2ca..67ee322 100644 --- a/pyas2lib/as2.py +++ b/pyas2lib/as2.py @@ -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