cope with missing email sender name string

workspace
Brendan Howell 7 years ago
parent f7b685ad81
commit 79d5489f67

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

Loading…
Cancel
Save