Hi,
We are having some issues to create a MSG file that opens in Outlook Web Access (OWA)
When we create a MSG file from Outlook directly (either by dragging an existing email or saving it on desktop), attaches it to an email and sends it out to a receiving party, the receiving party is able to open the MSG directly from the OWA.
However, when we attempt to generate the same MSG file using the Aspose.Email API, attach it to an email and sends it out to a receiving party, the receiving party cannot open the MSG directly from OWA. Instead, the MSG file is saved as an attachment.
As our client does not use a native Microsoft Outlook desktop application, this requirement is very important for us how we can create a MSG file that can open in OWA.
Please advise.
Thanks
Hi Alvin,
Thank you for writing to Aspose support team.
Your requirement refers to the fact where Outlook MSG file embedded in another MSG file has PR_ATTACH_METHOD value equal to 5. This can be achieved using the following sample code. Please try it at your end and let us know your feedback.
Sample Code:
MapiMessage msg = new MapiMessage("fromkashif.iqbal.aspose@gmail.com", "to@aspose.com", “Check message att display-2”, “This is a message body”);
MapiMessage attachMsg = MapiMessage.fromFile(“About Aspose.msg”); //load an attachment message
msg.getAttachments().add(“About Aspose”, attachMsg); //add it to attachments with PR_ATTACH_METHOD =5
ByteArrayOutputStream os = new ByteArrayOutputStream();
msg.save(os);
MailMessage mailMsg = MailMessage.load(new ByteArrayInputStream(os.toByteArray()), MailMessageLoadOptions.getDefaultMsg());
SmtpClient client = new SmtpClient(“smtp.gmail.com”, 587, “usrename”, “password”);
client.setSecurityOptions(SecurityOptions.Auto);
client.send(mailMsg);