mirror of
https://github.com/simple-login/app.git
synced 2025-11-10 01:40:49 +08:00
return only bounce report that can be decoded
This commit is contained in:
parent
278a9d19c6
commit
9c27f94e8e
1 changed files with 8 additions and 1 deletions
|
|
@ -644,6 +644,13 @@ def get_mailbox_bounce_info(bounce_report: Message) -> Optional[Message]:
|
|||
if not part["content-transfer-encoding"]:
|
||||
LOG.w("add missing content-transfer-encoding header")
|
||||
part["content-transfer-encoding"] = "7bit"
|
||||
|
||||
try:
|
||||
part.as_bytes().decode()
|
||||
except UnicodeDecodeError:
|
||||
LOG.w("cannot use this bounce report")
|
||||
return
|
||||
else:
|
||||
return part
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue