如何阻止电子邮件中的嵌入式图像被GMail作为附件显示? [英] How to stop embedded images in email being displayed as attachments by GMail?

查看:148
本文介绍了如何阻止电子邮件中的嵌入式图像被GMail作为附件显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在发送带有嵌入式图像的HTML电子邮件(作为附件),图像按照预期在GMail中显示。不过,他们也会在电子邮件中显示为附件。有谁知道如何避免这种情况,即我只希望他们仅在电子邮件中列出而不作为附件列出。我已经使用内容处置:内联。我正在使用Spring和JavaMail。

I am sending HTML emails with embedded images (as attachments) and the images display as expected in GMail. However they also show up as attachments under the email. Does anyone know how to avoid this i.e. I want them in the email only and not listed as attachments. I have used "Content-Disposition: inline". I am using Spring and JavaMail.

这是我的邮件最终的样子。任何人都可以看到什么是错的?

Here is what my mails end up like. Can anyone see whats wrong?

Delivered-To: ...
...
Subject: ...
MIME-Version: 1.0
Content-Type: multipart/mixed; 
    boundary="----=_Part_0_1248835444.1288246311187"

------=_Part_0_1248835444.1288246311187
Content-Type: multipart/related; 
    boundary="----=_Part_1_592250078.1288246311197"

------=_Part_1_592250078.1288246311197
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

<html>
<body>
<p><img src="cid:a0"/></p>
</body>
</html>
------=_Part_1_592250078.1288246311197
Content-Type: image/x-png
Content-Transfer-Encoding: base64
Content-Disposition: inline
Content-ID: <a0>

iVBORw0KGgoAAAANSUhEUgAAAPAAAABQCAYAAAAnSfh8AAAACXBIWXMAAC4jAAAuIwF4pT92AAAA
...
Qcz8hzyUxqGHjkNbsY4Df5iBg6OIwafQHBxFjP8PAIwl43uhncLdAAAAAElFTkSuQmCC
------=_Part_1_592250078.1288246311197--

------=_Part_0_1248835444.1288246311187--


推荐答案

按照以下步骤从GMail中获取此类邮件正文:

It is possible to get such a mail body out of GMail by following these steps:


  1. 通过Kent T插入图片

  2. 写邮件并在邮件中嵌入图片

  3. 将邮件发送给您自己

  4. 打开邮件。在右上角,用箭头向下(右边的回复)按下图片,然后按显示原稿。在这里你会找到一个这样的邮件的例子。

  1. enable in Gmail Labs "Inserting images by Kent T"
  2. write an mail and embed an image into the mail
  3. send the mail to yourself
  4. open the mail. On the upper right corner, press the picture with the arrow down (right near Reply) and press "Show original". There you will find an example of such a mail.

我做了这个,得到了下面的结果,图片没有列为附件。也许这个邮件正文可以帮助你用Spring和JavaMail创建一个合适的邮件:

I did this and got following result, where the image is not listed as attachement. Maybe this mail body helps you to create a proper mail with Spring and JavaMail:

MIME-Version: 1.0
...
Subject: ...
From: ...
To: ...
Content-Type: multipart/related; boundary=000e0cd62fb69a9c280493a7a1c0

--000e0cd62fb69a9c280493a7a1c0
Content-Type: multipart/alternative; boundary=000e0cd62fb69a9c250493a7a1bf

--000e0cd62fb69a9c250493a7a1bf
Content-Type: text/plain; charset=ISO-8859-1

[image: abc.png]

--000e0cd62fb69a9c250493a7a1bf
Content-Type: text/html; charset=ISO-8859-1

<img src="cid:ii_12bf191c5eab934e" alt="abc.png" title="abc.png"><br>

--000e0cd62fb69a9c250493a7a1bf--
--000e0cd62fb69a9c280493a7a1c0
Content-Type: image/png; name="abc.png"
Content-Transfer-Encoding: base64
Content-ID: <ii_12bf191c5eab934e>
X-Attachment-Id: ii_12bf191c5eab934e

iVBORw0KGgoAAAANSUhEUgAAAJ4AAADLCAIAAAAQpL1oAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAA
...

这篇关于如何阻止电子邮件中的嵌入式图像被GMail作为附件显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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