I am trying to generate an email text with an image inserted in it. I understand I should use the syntax <img src="cid:image-id" />
and add the image as attachment. I tried to do that and the result is the following :
--===============6239034322813840804==
Content-Type: multipart/alternative;
boundary="===============6051774682785554910=="
MIME-Version: 1.0
--===============6051774682785554910==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
my email in base64 with text only
--===============6051774682785554910==
Content-Type: text/html; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
my email in base64 with html
...
<img src="cid:my-image.png" alt="My Image">
...
--===============6051774682785554910==--
--===============6239034322813840804==
MIME-Version: 1.0
Content-Type: image/png; name="badge-img.png"
Content-Disposition: inline; filename="badge-img.png"
Content-ID: <badge-img.png>
Content-Transfer-Encoding: base64
iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAABmJLR0QA/wD/AP+gvaeTAAAACXBI
...
When sent, the image is in attachment (can open it, valid image). But in the displayed email content, I only see the alt text "My Image", not the image.
Any idea why ?