Python SMTPlib/Email

Posted on February 13, 2018

I followed the instruction which is written in Chinese to learn how to send emails by Python, here some tips from my practice:

  1. 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"'
    
    Issue
    Issue

    The issue can be fixed by using .addheader() function:

    att1.add_header('Content-Disposition', 'attachment', filename="1.cpp")
    

Here is my code:


Python SMTPlib/Email


donation

Scan the QR code using WeChat

comments powered by Disqus