电子邮件签名中的 base64 编码图像 [英] base64 encoded images in email signatures

查看:56
本文介绍了电子邮件签名中的 base64 编码图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在电子邮件签名中包含一些图片(公司徽标等).我在使用相关电子邮件系统生成的嵌入图像(它们通常作为附件发送)和链接图像(需要在收到的电子邮件中显示它们的许可)时遇到了各种各样的问题.

I have to include some images (company logo's etc) in email signatures. I've had all sorts of issues using the embedded images produced by the email system in question (they get sent as attachments generally) and as linked images (requiring permission to display them in the email received).

我刚刚看到一些来自 Exchange 的电子邮件,其中包含徽标的 base64 图像表示并使用标签进行显示.如果可能的话,我正在寻找有关如何在电子邮件签名中执行此操作的一些信息(如何开始生成 base64 版本的徽标以及需要什么代码才能使其工作)?

I have just seen some email from exchange that has a base64 image representation of the logo and uses a tag to do the displaying. I'm looking for some information on how I could do this in an email signature if possible (how do I generate the base64 version of the logo for a start and what code do I need to get it to work)?

我尝试过一些简单的事情,例如

I've tried simple things such as

<body>
<span>
<img src=.... >
</span>
</body>

但我得到的只是替代文字,所以我显然在这里做错了.

but all I get is the alt text so I'm obviously doing something wrong here.

推荐答案

重要

我在下面的回答显示了如何使用数据 URI 嵌入图像.这对 Web 很有用,但对于大多数电子邮件客户端来说不能可靠地工作.出于电子邮件目的请务必阅读 Shadow2531 的回答.

Important

My answer below shows how to embed images using data URIs. This is useful for the web, but will not work reliably for most email clients. For email purposes be sure to read Shadow2531's answer.

Base-64 数据在 img 标签中是合法的,我相信您的问题是如何正确插入这样的图像标签.

Base-64 data is legal in an img tag and I believe your question is how to properly insert such an image tag.

您可以使用在线工具或几行代码来生成 base 64 字符串.

You can use an online tool or a few lines of code to generate the base 64 string.

从内联数据中获取图像的语法是:

The syntax to source the image from inline data is:

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA
AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot">

http://en.wikipedia.org/wiki/Data_URI_scheme

这篇关于电子邮件签名中的 base64 编码图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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