Skip to content
Advertisement

How to prevent inline images from being converted to binary attachments in Microsoft Outlook?

My Java application creates an e-mail and sends it to a user. If the e-mail is sent to a Gmail account and the user checks his e-mail online in a web browser, the image that is in the body and at the bottom of the e-mail (i.e. not an attachment) will be displayed. However, if the e-mail is sent to a user who checks his e-mail via Microsoft Outlook (i.e. the e-mail passes through a Microsoft Exchange Server), the image is converted to a binary file and then attached to the e-mail, and at the bottom of the e-mail, the filename “ATT00001.bin” is displayed. How do I fix this issue so that the image will be displayed?

Here is what the e-mail should look like with the image, which should be at the bottom of the e-mail.

enter image description here

But here is how the e-mail looks in Microsoft Outlook. There is no image, only a binary file.

enter image description here

Here is my code for generating an e-mail with an inline image.

JavaScript

Advertisement

Answer

I wrote the following code, and it solved my problem. The difference between this one and the one above is that I called setText instead of setContent for the body text, and I called attachFile instead of setDataHandler for the image.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement