MIMEText doesn't accept the Name parameter

This commit is contained in:
Fabio Manganiello 2020-09-05 01:25:12 +02:00
parent e9d4ed3911
commit ce42f5aada
1 changed files with 4 additions and 0 deletions

View File

@ -168,6 +168,10 @@ class MailOutPlugin(MailPlugin, ABC):
elif _type == 'text':
_type_class = MIMEText
args = {}
if _type_class != MIMEText:
args['Name'] = os.path.basename(file)
with open(file, 'rb') as f:
return _type_class(f.read(), _subtype, Name=os.path.basename(file))