我必须在电子邮件签名中加入一些图片(公司标志等)。我遇到了各种各样的问题,使用由相关电子邮件系统生成的嵌入图像(通常作为附件发送)和链接图像(需要在收到的电子邮件中显示他们的权限)。
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).
我刚刚看到一些来自交换机的电子邮件,其中包含了logo64的图像表示,并使用标签进行显示。我正在寻找一些有关如何在电子邮件签名中做到这一点的信息(如果可能的话,我如何生成标识的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>但是我得到的都是alt文本,所以我显然在这里做错了。 >
but all I get is the alt text so I'm obviously doing something wrong here.
推荐答案重要
我的下面的回答显示了如何使用数据URI嵌入图像。这对于网络很有用,但是对于大多数电子邮件客户端 不能可靠地运行。为了电子邮件的目的 请务必阅读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.
您可以使用在线工具或几行代码生成基础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编码图像
发布评论