6

Is there any way to actually embed (not link to) an image in an email template in salesforce? What I have in mind would create an email with a 'Content-Type: text/html; charset="us-ascii"' in which it would refer to images like this:

<img src="cid:[email protected]" ....

so that the images are in the email, not gotten from a webserver.

I haven't seen any way to do this, everything refers to hosting them at salesforce in the documents (I would do that on my own webserver instead then).

1 Answer 1

2

You could base64 encode the image and use it as the source. This takes advantage of the Data URI scheme.

Example from the wikipedia page:

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA
AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />

You can find various free tools online that will convert your image to Base64, but keep in mind this has various drawbacks:

  1. No caching of image files (a problem for repeat viewing)
  2. Your email will be larger
  3. Your images will be larger due to the data scheme
  4. You have decentralized the image so you will not be able to update it in case of an error
2
  • Thanks, but I've read support for the data URI scheme in email clients may be limited, e.g. here. Others seem to suggest it is support in several email clients listed as no support in the URL. With all the problems we've had getting html to show correctly, I'd rather err on the side of caution here.
    – Legolas
    May 15, 2013 at 13:52
  • The wikipedia link has a (partial) list of supported email clients. HTML emails in general are tricky.
    – Mike Chale
    May 15, 2013 at 13:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .