通过邮件发送图像

发布于 2024-08-18 23:05:48 字数 638 浏览 10 评论 0原文

我写了一封邮件,将发送带有图像作为附件的电子邮件。这些图像显示在 yahoo 和 gmail 中。但 hotmail 在应该有图像的地方显示一个方形灰色框。以下是构建图像的代码。当然,我会使用 cid 在邮件中引用它。预先非常感谢。

l_embedImage = new MimeBodyPart();
l_dataSource = new FileDataSource(new File(l_imagesBaseDirectory + "/" + l_completeImagePath));
l_dataHandler = new DataHandler(l_dataSource);
l_embedImage.setDataHandler(l_dataHandler);
l_embedImage.setHeader("Content-ID", "<" + l_cid + ">");
l_embedImage.setHeader("Content-Type", "image/gif");
l_embedImage.setHeader("discrete-type","image");
l_embedImage.setHeader("content-transfer-encoding", "base64");
p_multipart.addBodyPart(l_embedImage);

I've written a mail that'll send emails with images as attachments. The images are displaying in yahoo and gmail. But hotmail is displaying a square grey box wherever there should be an image. The following is the code that builds the image. Of course I'm reffering to it in the mail using cid. Thanks a lot in advance.

l_embedImage = new MimeBodyPart();
l_dataSource = new FileDataSource(new File(l_imagesBaseDirectory + "/" + l_completeImagePath));
l_dataHandler = new DataHandler(l_dataSource);
l_embedImage.setDataHandler(l_dataHandler);
l_embedImage.setHeader("Content-ID", "<" + l_cid + ">");
l_embedImage.setHeader("Content-Type", "image/gif");
l_embedImage.setHeader("discrete-type","image");
l_embedImage.setHeader("content-transfer-encoding", "base64");
p_multipart.addBodyPart(l_embedImage);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

北城挽邺 2024-08-25 23:05:48

在我完成成为可信邮件服务器的步骤之前,我在发送电子邮件方面遇到了麻烦。

查看以下 URL 中的步骤 4(“验证您的出站电子邮件:发布发件人策略框架 (SPF) 记录”):
http://postmaster.msn.com/Guidelines.aspx

I was having troubles with delivering e-mails until I went through the steps to become a trusted mail server.

Check out step 4 ("Authenticate your outbound e-mail: Publish Sender Policy Framework (SPF) records") in the following URL:
http://postmaster.msn.com/Guidelines.aspx

装纯掩盖桑 2024-08-25 23:05:48

我认为hotmail不会自动加载它们,用户应该首先同意此消息:

附件、图片和链接
此消息已被阻止
您的安全。显示内容

像往常一样,微软必须完成程序员的生活;)

I think that hotmail doesn't load them automatically, the user should agree on this message first:

Attachments, pictures, and links in
this message have been blocked for
your safety. Show content

As usual Microsoft must complete programmers life ;)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文