How to stop embedded images in email being displayed as attachments by GMail?
It is possible to get such a mail body out of GMail by following these steps:
- enable in Gmail Labs "Inserting images by Kent T"
- write an mail and embed an image into the mail
- send the mail to yourself
- 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.
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
...