通过外部路径C#发送电子邮件 [英] Email with image via external path C#

查看:74
本文介绍了通过外部路径C#发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一种情况

我发送的电子邮件的图像为html正文



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" />





收到电子邮件后,src更改为





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

推荐答案

正在接收端进行更改,并作为安全措施完成,以防止垃圾邮件发送者跟踪当他们的消息被打开时。电子邮件客户端通常会显示下载外部图像的选项。



如果您不想将图像嵌入电子邮件中,那么您无能为力防止这种情况。
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.


这篇关于通过外部路径C#发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆