- preferred way:
- script to generate html content with image encoded as base64 text
- <img src='data:imag/png;base64,....'/>
- base64.b64encode().decode("ascii") to get that ... string from image
- single html file to include all the html and images, etc. 😀
- cat that html and pipe to mutt -e "set content_type=text/html" to send the email
- however, outlook does not support inline base64 image 😞
- one way to workaround is to pipe the html to a python script that
- extract that base64 string (... above)
- replace html code with <img src='cid:123' />
- create image object with
- image = MIMEImage(base64.decodebytes(....encode("ascii")), _subtype=<png/jpg/etc>)
- reference this image by
- image.add_header('Content-ID', '<123>')
- send the emails as shown in this example
- To send from windows outlook client rather than directly via smtp server: