Skip to content Skip to sidebar Skip to footer

Python-sent Mime Email Attachments Not Showing Up In Mail.live

I have a Python 3 script that uses MIMEMultipart to send an email with a .xlsx file it has generated attached. I used to use an identical script on Py2 to send the same generated f

Solution 1:

Changing

msg = MIMEMultipart('alternative')

to

msg = MIMEMultipart('html')

fixed it.

Solution 2:

Do me a favor and test if it works with yagmail. For doing HTML/attachments stuff I think it can really be useful: default is sending things in HTML, and attachments can just be done by pointing to the path.

All the code:

importyagmailyag= yagmail.SMTP('me@me.com', 'password')
yag.send("you@you.com", "SUBJECT", analysis_file)

The third field in send is contents, which can be a list of strings or just a string. If the string can be loaded as file, it will simply be attached.

For more info, check out the github page. Mind you, I'm the developer/maintainer.

Post a Comment for "Python-sent Mime Email Attachments Not Showing Up In Mail.live"