From ce42f5aada873956a21f8d016c7a4d06eeebfbd4 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 5 Sep 2020 01:25:12 +0200 Subject: [PATCH] MIMEText doesn't accept the Name parameter --- platypush/plugins/mail/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platypush/plugins/mail/__init__.py b/platypush/plugins/mail/__init__.py index 2eab06646..eecea0bf7 100644 --- a/platypush/plugins/mail/__init__.py +++ b/platypush/plugins/mail/__init__.py @@ -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))