Images Embedded Within HTML Email
Generally, images in HTML emails are loaded when the email reading software pulls the images in from the internet. That is how the header image is displayed for Possibilities emails.
The above assumes images are loaded at all. Most email reader settings can prevent loading of images from the internet. In which case, the Possibilities header image would not be displayed.
NOTE: With at least some gmail accounts, these images do not render, not even when images are turned on, when the email is viewed online at gmail.
If your HTML email absolutely must display an image, the image can be embedded within the email itself. No loading from the internet is then needed.
Probably the easiest way to embed an image into an HTML email is by using an img
tag with an src
value of the base64-encoded image. Here is the img
tag format.
<img src="data:image/TYPE;base64,CODE" style="max-width:100%;">
In the above format:
-
Replace
TYPE
with the image type. The image type is the file name extension that the image file would have, exceptjpg
is specified asjpeg
. Images can be of typejpeg
,png
, orgif
. -
Replace
CODE
with the base64-encoded image (see further below).
The image should then display within the HTML email, even if no images are loaded from the internet.
To test the method, you may use the following img
tag within the source code of an HTML email sent to yourself. When the email is opened, it should display the Willmaster logo.
<img src="data:image/gif;base64,R0lGODlhMgAyAOYAAEub4KzQ8fn7/FWh4pnG7WKbzdvb21OGsom965ubm7za89fX16LM77PV8uPj41yk45HC7GSp5YWFhVZ4lSKE2Xy152pqa4S66nKw5kOX3+3t7fHx8Xi051OVzaqqqi2K2zqR3aGhoev0/EaJw3p6eqfO8Gus5Wqh0lua0Y2jtr6+vjaQ3TOO3M3NzX646dHl90t8p8TExJbE7MLd9bHF13ykxoOpyvT5/ZvH7urq6uXx+6m6yBd+18bY6FRmdZezzM/k9rGxsY7A69vr+VGe4Xay53OYuTyIynSp2LzT5vX19W2u5pmuv8nh9pu714eYp9bo+IWy2l2g28zj9jCM26rQ8E2RzDyS3T6U3nWz6DaP3dTn92SQtjp/uxqA2GGGp0WY4C+M22er5fD3/eHu+ieH2kWX31xcXC+L21KPw5K/5oO35Ia55ECCu52/3ZKUll6Anqius3eIl5bE6snU3s7f7l5hY3ex47a3uOvy9zKJ1DmQ2p+xwWCm4kCV3v///yH5BAAAAAAALAAAAAAyADIAAAf/gH+Cg4SFg2MNGAMZPI08GQMYDWO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UEcI1BhBR0OIEEFXTkk0PTQQndgwAY5tODH0GUQkYXHvbIwQw5phJqECl+EyoYDNsTq8qtlhypnDngUIGoZWVRBgaYrTGGAFZW24KigYijBxKNzEw74CmVFerigFJRg4J1jArFAB2Ti4IARZJpQYZyNYx76jR5wUeaIf1wBQpZJstikBjVEWSGVc3cA+5EV/KFEAl8cOeZwH5hh/PEronA8AxEeX0SFZlTpgfLHV2/GDB5KcMDxH5gn2oYLNvhg/4QTVghACXPicQL46c0Wgh0KBjdIBCsQYb/9DJ5wP4Q13N87H0RA36zuAIESGNCAW3AIHiwAg/uBADSDgAIF9DMAKLTAPeoJQA5qIB8BMGEAAfiDA2JQAWAYIgcesIAP9EOBwBBCDMU5Th2CsBzjBCAGRjgOAhbwhIE4wANvQEIP7mWABbRABSEgwRkmMB4QlKUQOiFCaXYggROUxg0JMEJp1uABOUQAixY4QwGeIIHbWMAOZ/DBBArwm58hpRANYIEJ5kjHOtrxjnjM4xxZgJNKYAALGAikIAdJyEIa8pCAfAgRMsCBRjrykZCMpCQjmQGOtCIgSxGLJjfJSbGAoYchABkAGC5AylKa8pSoTCUpwUAEhwRDAH/kCVFmGZQlAFIv4AgABYgghF768pfADKYviUCBEIKjECIwARoiUJNmQiACaHjGMS3xgj5QAAAYgIAMtsnNbm4TAhgAAAX68IJptkITnPBDBIrgAgK4kwAuKEIE/NCJVZgTHIhQBCMcAQlJUGKagQAAOw==" style="max-width:100%;">
The above renders this:
(Update: There has been a report that the image does not display in gmail, even with images turned on.)
You can base64 encode images with the software at the Base64 Image SRC Code Generator article. It is a copy-and-paste install, no customization needed. (I am unable to make a live generator publicly available online because bad actors could bring our server to its knees by specifying an image of huge file size.)
The generator is easy to use. Pop the code it generates into the source code of your HTML email.
(This content first appeared in Possibilities newsletter.)
Will Bontrager