summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2016-09-02 07:40:04 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2016-09-02 07:40:04 (GMT)
commita3a89458a753eda02dc4ca54c0ec2230aab1827d (patch)
treed22b5ae8393c3c6d97af511edf29978154e51461
parent1fdb8783ce746532b2b8f06877e450c4dad79552 (diff)
downloadmail2redmine-a3a89458a753eda02dc4ca54c0ec2230aab1827d.zip
mail2redmine-a3a89458a753eda02dc4ca54c0ec2230aab1827d.tar.gz
mail2redmine-a3a89458a753eda02dc4ca54c0ec2230aab1827d.tar.bz2
don't fail if there's no body at all
-rw-r--r--mail2redmine.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/mail2redmine.py b/mail2redmine.py
index 85c69ef..d915aed 100644
--- a/mail2redmine.py
+++ b/mail2redmine.py
@@ -73,13 +73,15 @@ def create_ticket(mail):
attachments = []
+ body = u''
for data in mail.walk():
attachment = parse_attachment(data)
if attachment:
attachments.append(attachment)
elif data.get_content_type() == "text/plain":
- body = data.get_payload(decode=True)
- body = unicode(body, data.get_content_charset('utf-8')).encode('utf-8')
+ new_body = data.get_payload(decode=True)
+ if new_body:
+ body = unicode(new_body, data.get_content_charset('utf-8')).encode('utf-8')
# get project tech manager
tech_manager = None