I followed the instruction which is written in Chinese to learn how to send emails by Python, here some tips from my own practice:
Name of the attachment is shown as ‘ATT00002’
The name of the attachment in the receiver mailbox is shown in the format ‘ATT0000X‘ with the code:
att1["Content-Disposition"] = 'attachment; filename="runoob.txt"'
The issue can be fixed by using .addheader() function:
att1.add_header('Content-Disposition', 'attachment', filename="1.cpp")
Here is my code:
Scan the QR code using WeChat