下面的代码生成一封电子邮件,该电子邮件的图像可通过not邮件客户端(如gmail )查看,但不能通过thunderbird或outlook客户端查看。在这些客户端中可以看到一个断开的链接,并且出于某种原因,它不会提示我加载图像。当从另一个客户端转发相同的电子邮件时,它确实会提示我加载图像,一切都会按预期进行。
class Program
{
static void Main(string[] args)
{
var mesg = new MailMessage("destination@somewhere.com","from@somewhere.com");
mesg.Body = "<img src='http://localhost/images/bangs.JPG' />";
mesg.Subject = "Image Spike Test";
mesg.IsBodyHtml = true;
var client = new SmtpClient("localhost");
client.Send(mesg);
}
}下面是由该代码生成的电子邮件源。
MIME-Version: 1.0
From: destination@somewhere.com
To: from@somewhere.come
Date: 9 Jul 2011 09:25:08 -0500
Subject: Image Spike Test
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
<img src=3D'http://localhost/images/bangs.JPG' />发布于 2011-07-09 23:04:02
嗯,如果你发送这样的邮件,你的电子邮件阅读器将不得不去register.cwh.com索要图像。这将告诉register.cwh.com电子邮件被阅读的时间和来源。Outlook和其他电子邮件客户端保护您的隐私,并且不检索图像。我有点惊讶,GMail确实加载了它们。
一种适当的解决方法是将图像作为附件发送。Outlook将显示附件中的图像。
https://stackoverflow.com/questions/6635347
复制相似问题