Embedded Image in an Email Message has .bin extension

Hi,

I am creating an email and then embedding an image into it. That is all working fine. The issues is that there is a .bin file attached to the email. This is causing confusion with the recipient, as they want to open the .bin file. Do you know how I can stop that from being attached?

Here is a sample of the code.
<!— create the message objects —>
MailMessageFile = server.asposeLoader.create(“com.aspose.email.MailMessage”).init()
MapiMessageFile = server.asposeLoader.create(“com.aspose.email.MapiMessage”).init()
objMapiMessageFlags = server.asposeLoader.create(“com.aspose.email.MapiMessageFlags”)

<!— add the Images —>
tmpImg = server.asposeLoader.create(“com.aspose.email.LinkedResource”).init(“g:\folderpath\image001.png”, “application/octet-stream”)
tmpImg.setContentId(“Logo”)
MailMessageFile.getLinkedResources().add(tmpImg)

tmpImg = server.asposeLoader.create(“com.aspose.email.LinkedResource”).init(“g:\folderpath\image004.gif”, “application/octet-stream”)
tmpImg.setContentId(“kids”)
MailMessageFile.getLinkedResources().add(tmpImg)

<!— subject —>
MailMessageFile.setSubject(“Response to asdf’s Form 470 #1234”)

<!— body —>
MailMessageFile.setHtmlBody(‘

blah

’)

<!— Set the recipient of the message —>
mailContact = server.asposeLoader.create(“com.aspose.email.MailAddressCollection”).init()
mailContact.add(‘asdf@asdf.com’)
MailMessageFile.setTo(mailRecipient)

<!— create Mapi message and save —>
outlookMsg = MapiMessageFile.fromMailMessage(MailMessageFile)

outlookMsg.setMessageFlags(bitor(objMapiMessageFlags.MSGFLAG_UNSENT, objMapiMessageFlags.MSGFLAG_FROMME))

outlookMsg.save(“g:\folderpath\asdf_1234_mapi.msg”)

Thanks

This message was posted using Email2Forum by Babar Raza.

I figured out what is happening. The extra .bin files are caused by embedding images into the email that are not referenced with an in the body. Im not sure if this is caused by outlook or Aspose.

Hi Brian,


Thanks for writing to us.

I have tested this issue at my end with both your findings. An email was generated with linked resource and:

1. This linked resource was referenced in the body
2. This linked resource was not referenced in the body
This message was saved to disc and then sent via Outlook to the recipient. In both the cases, I was not able to observe the .bin attachments at the recipient end. Could you please confirm to us if you are getting the bin attachment in both cases at your end?