电子邮件签名中的 base64 编码图像

编程入门 行业动态 更新时间:2024-10-27 18:27:09
本文介绍了电子邮件签名中的 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">

en.wikipedia/wiki/Data_URI_scheme

更多推荐

电子邮件签名中的 base64 编码图像

本文发布于:2023-08-01 15:49:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1269624.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图像   电子邮件

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!