3

I'm trying to get inline images to work in emails that I'm sending through Sendgrid. Nothing has been working for me after hours of trying things. I don't really understand what CID is. I found a CID of the image I want to use by sending a regular email to myself with the image inline. It sends fine that way. But when I initiate the email through my server (rather than just in outlook.com) it isn't working. Do you really just put CID: and the random number. How is that supposed to produce the actual image if you haven't uploaded it.

Basically, referencing the image on my server didn't work, and I've tried base64 encoding and that didn't work. So now I'm trying to figure out if I'm supposed to send some different headers.

If anyone can send the code that they used to send inline images with the Sendgrid web api, it would be awesome.

programmingnewb
  • 129
  • 2
  • 9
  • Possible duplicate of [this post](http://stackoverflow.com/questions/3708153/send-email-with-phpmailer-embed-image-in-body). – Jakub Fedyczak Apr 04 '14 at 22:06
  • 2
    [This answer](http://stackoverflow.com/a/4312865/300836) gives a good overview of how images work in an email. "CID" is a content-ID; it's basically just used as a key to find the encoded image in the email. It doesn't "produce" the image, it just identifies it. – Matt Gibson Apr 04 '14 at 22:07
  • Thanks, I've seen that one before. I don't understand how the image gets produced then. If you aren't linking it in with a url, how are does it get added? – programmingnewb Apr 04 '14 at 22:09
  • I'm also not sure how to figure out the contentID of my image. Is that just a made up number? Is the one I saw when I embeded it through outlook always the same, or does it change? How do I figure out which headers I need. I see something about multipart mime, but it appears that there are many variations of this. – programmingnewb Apr 04 '14 at 22:14
  • Same issue here, was having images display fine in signatures, but broken when sent, thanks for explanation. So just replaced the `src` _cid_ 's with absolute urls; removed the `originalsrc` 's too. – Leo Dec 07 '16 at 22:44

0 Answers0