Open the source file in read non-binary mode in case of MIMEText

This commit is contained in:
Fabio Manganiello 2020-09-05 01:29:43 +02:00
parent 6dce4c59f6
commit 8a1f49a906

View file

@ -170,9 +170,12 @@ class MailOutPlugin(MailPlugin, ABC):
args = {} args = {}
if _type_class != MIMEText: if _type_class != MIMEText:
mode = 'rb'
args['Name'] = os.path.basename(file) args['Name'] = os.path.basename(file)
else:
mode = 'r'
with open(file, 'rb') as f: with open(file, mode) as f:
return _type_class(f.read(), _subtype, **args) return _type_class(f.read(), _subtype, **args)
@classmethod @classmethod