don't fail if there's no body at all

This commit is contained in:
Frédéric Péters 2016-09-02 09:40:04 +02:00
parent 1fdb8783ce
commit a3a89458a7
1 changed files with 4 additions and 2 deletions

View File

@ -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