Can you send images in data:uri format to GMail?

五迷三道 提交于 2019-11-27 14:34:30

问题


I'm making a web app in Django that sends user an image to their email.

The way that seems most attractive to me for sending the image is in the data:uri format.

However, I tested sending this email with a data:uri image in it to my GMail account, and the email shows, but without the image!

I know that Chrome and Firefox can both open data:uri images. So it's not a browser problem. But I don't see the data:uri image in GMail at all.

Does GMail not support data:uri images? Or possibly I'm sending them wrong?


回答1:


It's not supported.

Mail clients simply remove this from your post.

Here is a good reference of what can be supported:

http://www.campaignmonitor.com/css/




回答2:


Not supported. It's also blocked in other clients like Outlook.

Some reasons:

  • help avoid viewing potentially offensive material
  • with low-bandwidth connections, blocking inline images allows the client to decide whether a particular image warrants the time and bandwidth required to download it

You can attach an image with the src attribute pointing to a separate part of the message using a Content ID (CID).

<img src="cid:imagecid"/>
--001a1141059012513a055a1b9499
Content-Type: image/jpeg
Content-Transfer-Encoding: base64
Content-ID: <imagecid>

R0lGODlhDwAPAKIEAP/ql9yuA...
--001a1141059012513a055a1b9499--


来源:https://stackoverflow.com/questions/8580355/can-you-send-images-in-datauri-format-to-gmail

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!