0

I am receiving HTML emails with embedded images and the images display as expected in GMail. However in my html can't found image

following screenshot shows broken image in mail body and in inspect element it is

<img src="cid:image002.png@01D1BDB3.A9B852C0" v:shapes="_x0000_i1025" height="1227" width="1168">

Content-type : multipart/related.

enter image description here

  • You can try to check this [tutorial](https://sendgrid.com/blog/embedding-images-emails-facts/) on how to Embed Images in the Emails. It explains here how to do it by using CID embedded Images(Inline Images) and Inline Embedding(Base64 Encoding). You can also know here the pros and cons of the two. Also, it has a sample code that acts like a guide for the viewers. Check also this [SO question](https://stackoverflow.com/questions/24461133/can-you-and-how-do-you-embed-images-in-an-email-when-using-the-gmail-api?rq=1) for more information. – KENdi Jun 06 '16 at 00:36
  • I want to receive images in mail , i am not trying to send mail – Jignesh Aakoliya Jun 07 '16 at 05:04
  • did you find any solution for that ? – Md Hasibur Rahaman Oct 19 '21 at 17:08

1 Answers1

1

Like you state yourself, you are receiving a multipart/related mime type, but it looks like you're only looking at the text/html part.

A multipart/related mime type means there are at least 2 parts (each with it's own mime type), so apart from the text/html, there's probably a image/* mime type part.

In the case of embedded images, the Gmail API sends it in these different parts. As you can see in your case, the html part has a reference to the embedded image cid:image002.png@01D1BDB3.A9B852C0, this is the Content-ID value of the image/* mime type part.

So you would have to read the image/* part to get its value and use it to replace the cid in the html.

gdvalderrama
  • 713
  • 1
  • 17
  • 26