This commit is contained in:
Son NK 2020-11-10 17:42:23 +01:00
parent 4666d21f63
commit 4e16eb7403
1 changed files with 1 additions and 1 deletions

View File

@ -636,7 +636,7 @@ def copy(msg: Message) -> Message:
try:
# prefer the unicode way
return email.message_from_string(msg.as_string())
except (UnicodeEncodeError, ValueError):
except (UnicodeEncodeError, KeyError):
LOG.warning("as_string() fails, try to_bytes")
return email.message_from_bytes(to_bytes(msg))