Fix mail attachs tcmime *** (#4229)

When the file name consists of alphanumeric characters, it is normal to receive the attachment name.
However,However, problems will occur if the file name is changed to Chinese.
This has nothing to do with the file type
This commit is contained in:
apu 2019-12-17 09:47:01 +08:00 committed by GitHub
parent e9b24d62c6
commit 7d0096da6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -73,8 +73,7 @@ class MailSender(object):
part = MIMEBase(*mimetype.split('/'))
part.set_payload(f.read())
Encoders.encode_base64(part)
part.add_header('Content-Disposition', 'attachment; filename="%s"' \
% attach_name)
part.add_header('Content-Disposition', 'attachment', filename=attach_name)
msg.attach(part)
else:
msg.set_payload(body)