Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embedding Images to Emails

I have created a C# Webform progam for sending reminder emails to clients on my webpage.

It works fine in Outlook. and in Gmail on FireFox.

I just discovered (i dont use IE) that in IE 8 in gmail it doesn't display the image?

It just has an X and alt text.

I cant figure out why IE 8 and gmail wont dispaly the images and i have played with it a bit.

in C#:

LinkedResource emo2 = new LinkedResource(logoPath);
emo2.ContentId = "logo";
emo2.TransferEncoding = System.Net.Mime.TransferEncoding.Base64;
htmlView.LinkedResources.Add(emo2);

and in my HTML file :

<img id="header" alt="MyWebpage" src="cid:logo" />

Sending Newsletters via Email is SO frustrating with all the differnent clients. but i never thought Gmail would be my problem!

like image 376
Michael Avatar asked Aug 19 '11 07:08

Michael


1 Answers

We had a similar requirement to embed images in to the HTML email instead of link to the images hosted on our website. The main difference being that the user doesn't need to click "show all images" in their email client, i.e. the email should appear immediately rendered to the recipient.

We created the embedded images and it worked great in Outlook and some other email clients, but we discovered that some email clients don't like them as you've noticed with gmail. After a couple of days researching and trying different things, we concluded that there is no silver bullet to make your email correctly show it's embedded images in all major email clients.

We settled and just hosted the images on our website (which means the user gets the "show all images" button...), and used something like:

<img src="http://website/image.jpg"/>

If you have the patience, you could embed images for all email addresses except for certain address (such as @gmail.com), but my preference would be consistency and hence just link to the images.

like image 143
Chaos Avatar answered Oct 04 '22 10:10

Chaos