I am having problems understanding how to email an attachment using Python. I have successfully emailed simple messages with the smtplib
. Could someone please explain how to send an attachment in an email. I know there are other posts online but as a Python beginner I find them hard to understand.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
Here's another:
It's much the same as the first example... But it should be easier to drop in.
this is the code I ended up using:
Code is much the same as Oli's post. Thanks all
Code based from Binary file email attachment problem post.
For explanation, you can use this link it explains properly https://medium.com/@sdoshi579/to-send-an-email-along-with-attachment-using-smtp-7852e77623
Gmail version, working with Python 3.6 (note that you will need to change your Gmail settings to be able to send email via smtp from it:
Usage:
To use with any other email provider, just change the smtp configurations.