以下代码生成一封电子邮件,其中的图像通过网络邮件客户端(例如 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' />
请您参考如下方法:
好吧,如果您发送这样的邮件,您的电子邮件阅读器将不得不转到 register.cwh.com 以请求图像。这将告诉 register.cwh.com 电子邮件何时何地被阅读。 Outlook 和其他电子邮件客户端保护您的隐私并且不会检索图像。我有点惊讶 GMail 确实加载了它们。
正确的解决方法是将图像作为附件发送。 Outlook 将显示附件中的图像。
