switch policy SMTPUTF8 back to SMTP because headers are not encoded
This commit is contained in:
@@ -40,7 +40,7 @@ from copy import copy
|
||||
from email import message_from_binary_file
|
||||
from email.header import Header, decode_header, make_header
|
||||
from email.headerregistry import AddressHeader, _default_header_map
|
||||
from email.policy import SMTPUTF8
|
||||
from email.policy import SMTP
|
||||
from io import BytesIO
|
||||
from netaddr import IPNetwork, AddrFormatError
|
||||
|
||||
@@ -297,7 +297,7 @@ class QuarantineMilter(Milter.Base):
|
||||
# is read/modified by actions
|
||||
self.fp.seek(0)
|
||||
self.msg = message_from_binary_file(
|
||||
self.fp, _class=MilterMessage, policy=SMTPUTF8.clone(
|
||||
self.fp, _class=MilterMessage, policy=SMTP.clone(
|
||||
refold_source='none'))
|
||||
self.msginfo = {
|
||||
"mailfrom": self.mailfrom,
|
||||
|
||||
@@ -28,7 +28,7 @@ from bs4 import BeautifulSoup
|
||||
from collections import defaultdict
|
||||
from copy import copy
|
||||
from email.message import MIMEPart
|
||||
from email.policy import SMTPUTF8
|
||||
from email.policy import SMTP
|
||||
from html import escape
|
||||
from urllib.parse import quote
|
||||
|
||||
@@ -203,7 +203,7 @@ def _inject_body(milter):
|
||||
|
||||
|
||||
def _wrap_message(milter):
|
||||
attachment = MIMEPart(policy=SMTPUTF8)
|
||||
attachment = MIMEPart(policy=SMTP)
|
||||
attachment.set_content(milter.msg_as_bytes(),
|
||||
maintype="plain", subtype="text",
|
||||
disposition="attachment",
|
||||
|
||||
@@ -25,7 +25,7 @@ import os
|
||||
from calendar import timegm
|
||||
from datetime import datetime
|
||||
from email import message_from_bytes
|
||||
from email.policy import SMTPUTF8
|
||||
from email.policy import SMTP
|
||||
from glob import glob
|
||||
from time import gmtime
|
||||
|
||||
@@ -362,7 +362,7 @@ class FileMailStorage(BaseMailStorage):
|
||||
msg = message_from_bytes(
|
||||
self.get_mail_bytes(storage_id),
|
||||
_class=MilterMessage,
|
||||
policy=SMTPUTF8.clone(refold_source='none'))
|
||||
policy=SMTP.clone(refold_source='none'))
|
||||
return (metadata, msg)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user