2

I'm working to create an HTML email which includes 2 images. Currently, I'm using tags to place the image in the email. Problem is when users get the email, it's asking the user to "click to download" for security reasons.

Is there a way to embed the image in the email, to avoid this issue?

I'm using Coldfusion to send the email.

Thanks

4

3 回答 3

2

我尚未测试这是否适用于电子邮件客户端,但如果您将图像编码为 Base64,您可以将其包含在 HTML 中,这样可以避免连接到远程服务器的问题。

以下是使用 CFML 执行此操作的方法:

<cfset ImageFile = "/path/to/image.png" />
<cfset ImageInfo = "image/png;charset=utf-8;base64" />
<cfset ImageData = ToBase64( FileReadBinary( ImageFile ) , 'utf-8' ) />

<cfoutput>
    <img src="data:#ImageInfo#,#ImageData#" alt="my picture" />
</cfoutput>
于 2010-05-13T16:07:27.847 回答
2

cfmailparam您可以使用和链接到附件而不是外部文件将图像作为附件嵌入。

http://www.bennadel.com/blog/61-CFMail-CFMAILPARAM-Used-to-Embed-Images-in-Email.htm

于 2010-05-14T00:25:32.860 回答
-1

我相当肯定这是一个电子邮件客户端问题,而不是您放在一起的电子邮件/HTML。我不知道(并且快速的谷歌没有显示)有任何方法可以用 HTML 解决这个问题。

一种可能的解决方案可能是创建富文本电子邮件并将图像嵌入到 RTF 中,不确定这是否可以解决您的问题。

其他想法是您是否必须在电子邮件中包含图像?您可能会更好地制作电子邮件格式,以便不依赖图像进行格式/美学,但如果客户显示它们,则允许它们包含在内。不确定您的目标受众是谁,但在我的工作中,我们必须经常处理仅限于纯文本电子邮件的用户。

于 2010-05-13T16:02:51.383 回答