From 79d5489f6760b3dcf593f511f3d23e13b7165249 Mon Sep 17 00:00:00 2001 From: Brendan Howell Date: Sat, 28 Oct 2017 15:33:42 +0200 Subject: [PATCH] cope with missing email sender name string --- screenless/bureau/mailroom/mailroom.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/screenless/bureau/mailroom/mailroom.py b/screenless/bureau/mailroom/mailroom.py index 57291fc..1585496 100644 --- a/screenless/bureau/mailroom/mailroom.py +++ b/screenless/bureau/mailroom/mailroom.py @@ -304,10 +304,11 @@ class MailRoom(Bureau): msg.msgid = str(msgid) sender = envelope.from_[0] if sender.name is None: - sender.name = b"" + msg.fromname = "" + else: + msg.fromname = clean_header(sender.name.decode("utf-8")) msg.fromaddr = sender.mailbox + b"@" + sender.host msg.fromaddr = clean_header(msg.fromaddr.decode("utf-8")) - msg.fromname = clean_header(sender.name.decode("utf-8")) msg.date = data[b"INTERNALDATE"].strftime("%d. %B %Y %I:%M%p") msg.subject = clean_header(envelope.subject.decode("utf-8"))