如何成功地将图像嵌入 HTML 以在 webmail 客户端中显示?

2022-01-15 00:00:00 format base64 html webmail

我正在尝试使用以 base 64 数据 URL 编码的图像在 HTML 中进行签名.这是一个例子:

<img src="data:image/png;base64,iVBORw0KGgoAAAAN...kJggg==">

它与 Mac 上的 Mail 或 Thunderbird 等邮件软件很好用,但不适用于 gmail、outlook、roundcube、hotmail 等 webmail ...

你知道如何让它工作吗?我真的很想把那些图片直接放在源代码中,这样更实用.

解决方案

简单回答?

你不能.Gmail、outlook 等将忽略 base64 图像.

<块引用>

因此,根据我们的结果,显然不值得在您的电子邮件中使用嵌入图像.您将要做的就是强迫人们下载他们无法查看的编码图像.

I'm trying to do a signature in HTML using images that are encoded in base 64 data URLs. Here's an example:

<img src="data:image/png;base64,iVBORw0KGgoAAAAN...kJggg==">

It's working nice with mail software as Mail on Mac or Thunderbird but it's not working with webmail such as gmail, outlook, roundcube , hotmail ...

Have you any idea how to make it work ? I really want to put those images directly in the source code, it's more practical.

解决方案

simple answer?

You can't. Gmail, outlook etc will ignore base64 images.

Look at this site to learn more about this

So based on our results, it is clearly not worth using embedded images in your emails. All you will be doing is forcing people to download encoded images that they will not be able to view.

相关文章