如何将图像嵌入 Outlook HTML 电子邮件? [英] How to embed an image into an Outlook HTML email message?

查看:60
本文介绍了如何将图像嵌入 Outlook HTML 电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个 Winforms 应用程序,它支持将 HTML 块拖放到 Outlook (HTML) 邮件消息中.

We have a Winforms application which supports dragging and dropping chunks of HTML into Outlook (HTML) mail messages.

文本块很好.

但是我们如何处理图像呢?假设我们不想在线托管图像,而是希望通过电子邮件发送它们.还假设我们确实希望看到内嵌图像,而不是作为附件(当然,收件人的电子邮件客户端支持).

But how do we proceed with images? Let's assume we don't want to host the images online but instead we want to send them with the email message. Assume also that we do want to see the image inline, not as an attachment (where the recipient's email client supports that, of course).

如果您查看 Outlook 邮件的 HTML 源代码,则有图像的cid"标签(我猜是将图像作为附件指向),但是我们如何生成 cid/contentid?

If you look at the HTML source of an Outlook message there are "cid" tags for images (which point to the image as an attachment I guess), but how do we go about generating a cid/contentid?

推荐答案

如果流程中的手动步骤是一个选项,您可以这样做:

If a manual step in the process is an option, you can do it like this:

  1. 自动或手动创建 HTML 作为保存的 HTML 文件,使用 标签链接到本地保存的图像文件
  2. 在选择 HTML 文件作为附件时,使用隐藏在插入"按钮上的向下箭头下方的作为文本插入"选项将 HTML 附加到 Outlook 电子邮件中.
  1. create the HTML automatically or manually as a saved HTML file, with <img> tags that link to locally-saved image files
  2. attach the HTML to an Outlook email using the 'Insert as text' option tucked away under the down-arrow on the "Insert" button when selecting the HTML file as an attachment.

这会使用文件中的 HTML 填充 HTML 电子邮件并嵌入所有图像.我相信这个工具使用 Base64 编码来嵌入图像,如 Sam 的电子邮件中所述.

This populates the HTML email with the HTML from the file and embeds all images. I believe this tool uses Base64 encoding to embed the images as described in Sam's email.

根据工作流程,此方法可能比自己将图像转换为 Base64 更容易.

Depending on the workflow, this method might be easier than converting images to Base64 yourself.

请注意,此方法仅适用于 Windows 版 Outlook,不是 Mac 版 Outlook.

这篇关于如何将图像嵌入 Outlook HTML 电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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