user2431128
user2431128

Reputation: 11

Embedding a static image in html email

I have a requirement where in I have to to send an email to customer, I have an email template coming in from database (blob data). And there is an header image which should be displayed in the email when customer opens the email.

  1. The image will not be available on server
  2. The image will not be available online (i.e in any website online).

This image is a client header. How can I embed the static image without referring to any location or any online website.

Upvotes: 1

Views: 2126

Answers (3)

Anand Shah
Anand Shah

Reputation: 633

in case you don't want to load images from the server then only embeding of image with base64 can workout.

Please refer the link below for more reference.

http://www.bigfastblog.com/embed-base64-encoded-images-inline-in-html

Upvotes: 0

itsadok
itsadok

Reputation: 29342

The general solution to this problem is multipart MIME. You add the image as a part of the email message and use a cid reference in the <img> tag.

However, you're probably using some library to send this email, in which case it probably has an API for creating multipart MIME messages.

Upvotes: 0

MaVRoSCy
MaVRoSCy

Reputation: 17849

Yes this is possible by encoding the image in Base64

For more info see this Displaying images in webpage without src URL

Finally you will end up with something like this in your html message:

<img src="data:image/png;base64,iVBORw0KGgoAA.........very_long_string....." />

Upvotes: 2

Related Questions