是否可以使用 CFMailParam 嵌入 base64 图像?
Is it possible to embed a base64 image with CFMailParam?
我正在开发一个应用程序,该应用程序使用 canvas 根据用户输入创建自定义图像,我想知道是否可以允许用户通过电子邮件将 base64 最终产品的副本发送给自己,或者是否可以我必须将其转换为 .jpg
或 .png
,然后将其嵌入。
谢谢。
我建议将 Base64 转换为图像,写入磁盘,然后使用 cfmailparam attach/inline 它以及自动将其从磁盘中删除。
除了尝试使用 cfmail 将 base64 图像直接 inline/attach 发送到电子邮件外,我什么都没有。我已经部分成功地将 base64 转换为图像对象(使用 ImageReadBase64()),然后使用图像对象作为 cfmailparam 内容属性的值并省略文件属性,但是图像通过反转颜色非常奇怪。
关于一些示例代码...
<cfsavecontent variable="mailContent">
...
<img src="cid:signature">
...
</cfsavecontent>
<cfset sigImage = ImageReadBase64(SIGNATURE_IMAGE_BASE64)>
<cfimage source="#sigImage#" destination="tmpSigImage.png" action="write" overwrite="true">
<cfmail ...>
#mailContent#
<cfmailparam
file="#ExpandPath('./tmpSigImage.png')#"
contentid="signature"
disposition="inline"
remove="yes"
/>
</cfmail>
我正在开发一个应用程序,该应用程序使用 canvas 根据用户输入创建自定义图像,我想知道是否可以允许用户通过电子邮件将 base64 最终产品的副本发送给自己,或者是否可以我必须将其转换为 .jpg
或 .png
,然后将其嵌入。
谢谢。
我建议将 Base64 转换为图像,写入磁盘,然后使用 cfmailparam attach/inline 它以及自动将其从磁盘中删除。
除了尝试使用 cfmail 将 base64 图像直接 inline/attach 发送到电子邮件外,我什么都没有。我已经部分成功地将 base64 转换为图像对象(使用 ImageReadBase64()),然后使用图像对象作为 cfmailparam 内容属性的值并省略文件属性,但是图像通过反转颜色非常奇怪。
关于一些示例代码...
<cfsavecontent variable="mailContent">
...
<img src="cid:signature">
...
</cfsavecontent>
<cfset sigImage = ImageReadBase64(SIGNATURE_IMAGE_BASE64)>
<cfimage source="#sigImage#" destination="tmpSigImage.png" action="write" overwrite="true">
<cfmail ...>
#mailContent#
<cfmailparam
file="#ExpandPath('./tmpSigImage.png')#"
contentid="signature"
disposition="inline"
remove="yes"
/>
</cfmail>