From ed897f6165b10def8c706facbdaa77c0abfa64ef Mon Sep 17 00:00:00 2001 From: Noah Bass Date: Fri, 20 Oct 2017 16:44:05 -0400 Subject: [PATCH] Update get_payload to decode the Content-Transfer-Encoding header This will decode the message payload if it's in base64 or quoted-printable See get_payload documentation for details on using `decode=True`: https://docs.python.org/2/library/email.message.html#email.message.Message.get_payload --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index e40d3a2..893608b 100644 --- a/main.py +++ b/main.py @@ -72,7 +72,7 @@ def emailParser(raw_email): msg_body = "" for part in msg.walk(): if part.get_content_type() == 'text/plain': - msg_body = part.get_payload() + msg_body = part.get_payload(decode=True) slackWebHook(msg_subject,msg_from,date_epoch,msg_date,msg_body) def slackWebHook(subject, email_from, date_epoch,date_header, body):