I've been playing around with the email module in python but I want to be able to know how to embed images which are included in the html.
So for example if the body is something like
<img src="../path/image.png"></img>
I would like to embed image.png into the email, and the src
attribute should be replaced with content-id
. Does anybody know how to do this?
Here is an example I found.
For Python versions 3.4 and above.
The accepted answer is excellent, but only suitable for older Python versions (2.x and 3.3). I think it needs an update.
Here's how you can do it in newer Python versions (3.4 and above):