I am sending emails from my gmail account.
I'm looking for the safest, cross-client way to send inline messages so that they all display inline images.
The problem occurs when sending html emails with embedded images: not all clients / web links display images. I am looking for a method that is either client or client.
I use python and I can control the headers and content types, etc.
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO 9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />
or
<div style="width: 80px; height: 80px; background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAA AAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==' ) no-repeat" />
With the following html code, the image / is not displayed ...:
- Thunderbird desktop client: alwasy displayed
- gmail webmail: never displayed
- yahoo webmail: usually
- hotmail webmail: rare
- firefox + chrome - as url: always displayed
I could not understand the pattern when it works and when not (except for obvious syntax or coding errors).
What i have done so far:
- Browser URL (as indicated above - it always displays images)
- enabled "image display" in all of these clients / web pages
- enabled "display images from xxxx" in all these clients / web pages
- Confirmed using the "message source" (or gmail "show original") - usually the image code is displayed.
- copied the same code from the "view source" and checked in js fiddle
- added coding "utf-8"
- I tried to send images using file attachments instead of base64 embedded urls. There were other problems with this approach.
sending html message as UTF-8
msgpart = MIMEText (body_html, "html", "utf-8")
changed the message type with a few parameters .. now it is MIMEMultipart ("alternative") - maybe there is a different format that I should use?
- tried using CSS notation and SRG IMG notation (see above). The css version is not always supported.
(the above example is taken from Wikipedia)
You can even put this line in the URL of your browser - it works, that is, it displays an image
Does gmail smpt require special arguments? parameters?
I think if the email is displayed in thunderbird, it is probably sent correctly.
maybe
source share