Base64编码的图像到Gmail [英] Base64 images to gmail

查看:1835
本文介绍了Base64编码的图像到Gmail的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是生成从iPad发送的电子邮件一些内嵌图片。看起来所有的桌面电子邮件客户端伟大的,但Gmail的似乎并不喜欢以base64图像,并显示为文本。

I'm generating some inline images for an email sent from the iPad. Looks great in all desktop email clients, but gmail doesn't seem to like the base64 image and it shows up as text.

任何人有任何运气与嵌入Base64和Gmail的图像?
或者知道一个更好的解决方案,为从iPad与图像发送HTML格式的电子邮件?

Anyone have any luck embedding images with base64 and gmail? Or know of a better solution for sending HTML emails with images from the iPad?

推荐答案

从莫因扎曼显示测试结果,已经过时(2008年)的链接。正如我今天Gmail也支持这两种方法显示嵌入式图像彻底的测试。

The links from Moin Zaman show test results that are outdated (from 2008). As of my thorough testing today Gmail does support displaying embedded images for both methods.

使用base64编码图像内嵌在< IMG SRC =...>

Use base64 encoding image inline within <img src="...">

<html><body><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA9QAAADmCAIAAAC77FroAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAO..."</body></html>

使用的base64 EN codeD映像作为附件

Use base64 encoded image as attachment

Message-ID: <BE0243A40B89D84DB342702BC5FD6D313EA3BE1B@BYMAIL.example.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: yes
X-MS-TNEF-Correlator:
x-originating-ip: [xxx.xxx.xxx.xxx]

Content-Type: multipart/related;
    boundary="_038_BE0243A40B89D84DB342702BC5FD6D313EA3BE1BBYMAIL_";
    type="multipart/alternative"
MIME-Version: 1.0
Return-Path: email@example.com
X-OriginatorOrg: example.com

--_038_BE0243A40B89D84DB342702BC5FD6D313EA3BE1BBYMAIL_
Content-Type: multipart/alternative;
    boundary="_000_BE0243A40B89D84DB342702BC5FD6D313EA3BE1BBYMAIL_"

...skipping Content-Type: text/plain which would be here for this example...

--_000_BE0243A40B89D84DB342702BC5FD6D313EA3BE1BBYMAIL_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html><body><img border=3D"0" width=3D"980" height=3D"230" id=3D"Picture_x0020_1" src==3D"cid:image001.png@01CDA268.204677C0"></body></html>

--_000_BE0243A40B89D84DB342702BC5FD6D313EA3BE1BBYMAIL_--

--_038_BE0243A40B89D84DB342702BC5FD6D313EA3BE1BBYMAIL_
Content-Type: image/png; name="image001.png"
Content-Description: image001.png
Content-Disposition: inline; filename="image001.png"; size=32756;
    creation-date="Mon, 08 Oct 2012 15:27:07 GMT";
    modification-date="Mon, 08 Oct 2012 15:27:07 GMT";
Content-ID: <image001.png@01CDA268.204677C0>
Content-Transfer-Encoding: base64

iVBORw0KGgoAAAANSUhEUgAAA9QAAADmCAIAAAC77FroAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAO
xAAADsQBlSsOGwAAf5lJREFUeF7tvQlgVdW18L+ZR20mpsSLCYlBQKwgwRCMr9TAqzg0CAl98Y9a
ikBfHxL1A/r0tUr77Feg1mDav4LUijxTk8hLRIstQ2mJhEiAWAEpNCGRa8KUSQXCzLf2cOZz7j33
5s5Zx6j3nruHtX97n33WWWfttbtdv36d4IEEkAASQAJIAAkgASSABJCA/wl0938VWAMSQAJIAAkg
ASSABJAAEkAClAAq3zgOkAASQAJIAAkgASSABJBAgAig8h0g0FgNEkACSAAJIAEkgASQABJA5RvH
...

做自己的测试,您可以用下列方法之一内嵌嵌入图像发送电子邮件

To do your own testing, you can send email with inline embedded image using one of the following techniques

发送使用上述任何一个电子邮件到您的Gmail帐户,然后打开Gmail的Web客户端(即适用于任何浏览器)的电子邮件,并使用向下箭头旁边的回复按钮,选择显示原始选项。这将显示它是如何收到。

Send an email using one of the above to your Gmail account, then open the Email in Gmail Web Client (any browser that works) and use the Down-Arrow next to the Reply button to choose the Show Original option. This will show you how it is received.

我认为最好的做法是使用嵌入式图像作为附件的方法。

I think best practice is to use the embedded image as attachment method.

在我使用Gmail Web客户端的测试,如果我在不同大小的单个电子邮件发送30幅图像,有几个不会成功加载显示图像的容器而不是图像。如果出现这种情况,请尝试重新加载页面。

In my testing with Gmail Web Client, if I sent 30 images in a single email of different sizes, a few would not load successfully showing image container but not the image. If that happens, try reloading the page.

在我的测试(Windows 7)中...

In my testing (Windows 7)...


  • 铬(最新的)需要几个重载的成功加载/显示所有30个图像

  • 歌剧(最新)将无法成功显示所有30幅无论重载的数量

  • 火狐(最新)一致显示所有30幅没有问题

  • 的Internet Explorer 9(最新)一致显示所有30幅没有问题

  • Safari浏览器(最新)一致显示所有30幅没有问题

这篇关于Base64编码的图像到Gmail的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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