Free Support Forum -

Insert embedded image from file in editable outlook email

We are trying to generate an html unicode Microsoft Office Outlook email (.msg) that users can still edit in Outlook before sending it.
This works fine except when manually adding an image from a file into the body of the generated email.
This is done using the Outlook Menu: Insert > Image > From file.

In Outlook 2003:

  • either the message can’t be send because we get the error dialog “Unspecified error” (in Dutch)
  • or the image is not included when the mail is sent.
In Outlook 2010:
  • The image is sent as an attachment and is not inline anymore.

  • If we manually add a random attachment to the generated email and keep or remove this attachment, the problem is solved (but this is not a workaround).
  • If I add an attachment automatically in the generation, the problem remains.
  • If we copy/paste an image into the body using the
    clipboard instead of inserting it from a file, there is no problem (but
    this is not a workaround).

I assume that a sort of header is missing that is corrected when an attachment is added manually.

I tried the Aspose.Network (2.2.0 and 2.3.0) and the Aspose.Email 1.0.0 library for Java and this is the example code you can use to simulate the problem:

MailMessage message = new MailMessage();
message.setSubject(“Mail creation (unicode: èçü)”);


… content


MapiMessage mapiMsg = MapiMessage.fromMailMessage(message,OutlookMessageFormat.UNICODE);
mapiMsg.setMessageFlags(MapiMessageFlags.MSGFLAG_UNSENT | MapiMessageFlags.MSGFLAG_FROMME);
File tempFile = File.createTempFile(“mail”, “.msg”);
FileOutputStream outputStream = new FileOutputStream(tempFile);;
System.out.println("created msg: "+tempFile.getAbsolutePath());

If you then open this .msg with Outlook, insert an image from file and send it, the problem occurs.

We really need this fixed because our users will not be aware that their included images will not be sent and received.


Thank you for reporting this issue and providing us your detailed analysis. We are currently evaluating your said issue with all possible scenarios and we will keep you posted on this.

Hi Again,

I am still investigating the issue but I have found a workaround that solves the problem with Outlook 2010. Can you please test this workaround with Office Outlook 2003 version and post your results here.

Instead of creating the MSG file through your code, create a “New Email” in Outlook and save this blank email in “Outlook Message Format - Unicode (.msg)” (File -> Save As).
Load this MSG file into an instance of MapiMessage, make desired changes and save back. Now you can manually open the resultant MSG file, insert an image and send to the recipients. The image will stay intact when received.

Source code to load and edit MSG file is as below,

MapiMessage mapiMsg = MapiMessage.fromFile(“test.msg”);
mapiMsg.setSubject(“Mail creation (unicode: èçü)”);
mapiMsg.setBodyContent("Bold text
Unicode äöü
", BodyContentType.HTML);
mapiMsg.setMessageFlags(MapiMessageFlags.MSGFLAG_UNSENT | MapiMessageFlags.MSGFLAG_FROMME);“out.msg”);

The implementation of your code in our implementation
results in the same problem in outlook 2003: either we get an “Unspecified error”
message or a mail without the included image.

However because of some more testing I did, I found out that in Outlook 2003 there seems to be a generic bug: Whenever you reopen a saved outlook msg from a file and insert an inline image, your image will be lost upon sending it.
The only way to insert and sent manually an inline image successfully in 2003 is to create a new email in Outlook 2003, insert your image and sent it.
If you open a previously saved draft msg from a file in 2003 (it doesn’t matter if it is a 2003, 2007 or 2010 msg), the problem will occur.

Remark: In Outlook 2003 there is no normal way of saving a .msg to a file. The only way is to create a new mail, save it, find it in your ‘Drafts’ folder and then drag it to your explorer so that it will create a .msg there.

So it doesn’t look good for draft generation of emails to be used in Outlook 2003 …