I am looking to send an image embedded in HTML to send out to a list of senders.
I need to use win32com.client, SMTP is blocked. The image is saved as png and is originally a matplotlib bar chart.
The script successfully sends out the email the recipients cannot see the image embedded in the email. However, I can see the image when I send the email to myself.
I tried to attach the image to the email, still no luck.
email = """<body>
<p><img src="C:\output.png"></p>
</body>
"""
import win32com.client
olMailItem = 0x0
obj = win32com.client.Dispatch("Outlook.Application")
newMail = obj.CreateItem(olMailItem)
newMail.Subject = "the subject"
newMail.HTMLBody = email
newMail.To = "[email protected];[email protected]"
attachment1 = "C:\output.png"
newMail.Attachments.Add(attachment1)
newMail.Send()
Any help greatly appreciated!