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
1 changed files with 4 additions and 1 deletions

View File

@ -170,9 +170,12 @@ class MailOutPlugin(MailPlugin, ABC):
args = {}
if _type_class != MIMEText:
mode = 'rb'
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)
@classmethod