Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here is a situation
I am sending an email that has image as html body

<img src="http://www.google.com/images/srpr/logo11w.png" alt="click me" />


After receiving email image src is changed to

<img src="https://bay179.mail.live.com/Handlers/ImageProxy.mvc?bicild=&amp;canary=ei12UmVJE9u9hgMk5TdV12Y1X%2b9Vc365IL%2bmULwd%2bfk%3d0&amp;url=http%3a%2f%2fwww.google.com%2fimages%2fsrpr%2flogo11w.pngf" alt="click me">


Hence does not render image. Following is the code to used to send email

SmtpClient sc = new SmtpClient("smtp.live.com");
                sc.Port = 587;
                sc.UseDefaultCredentials = false;
                sc.Credentials = new NetworkCredential("someemail@hotmail.com", "password");
                sc.EnableSsl = true;
                MailMessage m = new MailMessage();
                m.From = new MailAddress("someemail@hotmail.com");
                m.Subject = "test subject";
                m.IsBodyHtml = true;
                m.Body = "<img src=\"http://www.google.com/images/srpr/logo11w.png\" alt=\"click me\" />";
                m.To.Add(new MailAddress("someemail@hotmail.com"));
                sc.Send(m);


I dont want to embed image.
Thanks in advance
Posted

1 solution

That change is being made at the receiving end, and is done as a security measure to prevent spammers from tracking when their messages are opened. The email client will usually display an option to download external images.

If you don't want to embed the image in the email, then there is nothing you can do to prevent this.
 
Share this answer
 
Comments
hotthoughtguy 18-Apr-15 14:48pm    
But i have seen many emails that has embedded URL for image src and it works fine with hotmail server. So there must be a way to do this
Richard Deeming 20-Apr-15 8:04am    
Yes, if you embed the image, then it will work.

However, your question explicitly states that you do not want to embed the image.

If you don't embed the image, then the majority of email clients will not load it unless the user selects the "download images" option.
hotthoughtguy 21-Apr-15 12:07pm    
I don't want to embed image. I have embedded the source url for that image.
For example i have two images one of them gets changed. i:e

<pre lang="HTML">
<img src='http://www.google.com/images/srpr/logo11w.png' alt='click me' />
<img src='https://campaign-uploads.s3.amazonaws.com/newsletter/2015/19Apr_wk17/EN/images/logo.jpg' /></pre>
</pre>

Second image's URL remains same but first image's URL gets changed
Richard Deeming 21-Apr-15 12:25pm    
It's quite simple:

If you embed the image in the message, then it will display.

If you use a remote image, then 90% of email clients will not display it until the user chooses the "download images" option.

There might be special cases where some client programs trust certain domains, and display remote images hosted on those domains without user interaction. However, that will be a rare exception, and cannot be relied upon.

Again, if you do not embed the image in the message, then the image will not be displayed by default.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900