You need to sign in to do that
Don't have an account?
Ken Koellner
It may be that the email and attachment classes in Apex are just not deep enough to perform this task. But if anyone know's a way to do it, feel free to post suggestions.
send inline attachment image in html email (maybe a way to set cid: URL)
We have a repository that holds text for email as pure HTML. I have some code to send email with this text as the html body and that works well and is fairly simple. We can also add attachments.
What I haven't figured out how to do is embed and image in the email. From what I understand, the email would have in it a "cid:" URL like --
<img width="128" height="128" id="Picture_x0020_1" src="cid:image001.png@01CF6E9E.C4B30B30">I could compose a tag like that no problem. The issue is the cid: for the image. I know how to add attachments. And I know you can set the inline flag to true or false. What I can't see a way to do is set the id for an attachment I'm including (or get back an ID after attaching it) so I can then put that content id (cid:) in the URL in the HTML body.
It may be that the email and attachment classes in Apex are just not deep enough to perform this task. But if anyone know's a way to do it, feel free to post suggestions.
I
a. You embed the image as base-64 encoded string in your HTML email template/message
b. You assign a content-id to the block
c. You reference it in the IMG tag using the "cid" attribute.
Let me know if this helps at all.
Hi Ken - I just hit the same problem - did you find a workaround/solution? If only we had an Content-ID assigned!
@ Saurabh: Yes the embeded base-64 works fine in a web browser (except for IE7) but it just doesn't work in an Email browser, which is very frustrating.
a lot of email clients (gmail, yahoo + outlook) doesn't support base64
images https://www.campaignmonitor.com/blog/email-marketing/2013/02/embedded-images-in-html-email/