I use Aspose Email Java to convert a msg File to PDF file, the rendering result is good, however, only Email body get displayed, yet message title, sender and receiver disappear on PDF.
Here it is the msg test file, because this forum doesn’t support msg file upload, so I zip it guntherMails.zip (2,3 MB)
final MailMessage message = MailMessage.load(emailFilename);
message.save("TempHtmlOutput.html", com.aspose.email.SaveOptions.getDefaultHtml());
final Document document = new Document("TempHtmlOutput.html");
document.save(targetPDFname, SaveFormat.PDF);
I use Aspose Email to list and download all attachments of the msg file, it the same test msg file in this topic thread.
There are 4 attachment files, however Aspose Email can only find 3 of them. The Attachment “1001.zip” can not be found by Aspose Email.
During debug, the value of “msg.getAttachments().size()” is 3, although it should be 4!
I use following code:
final MapiMessage msg = MapiMessage.fromMailMessage(emailFilename);
final String dataDir = "AsposeTemp";
for (int i = 0; i < msg.getAttachments().size(); i++) {
//Set a reference to the MapiAttachment object
MapiAttachment outlookMessageAttachment = (MapiAttachment) msg.getAttachments().get_Item(i);
//Display attachment type
System.out.println("Att Type : " + outlookMessageAttachment.getMimeTag());
//Display attached file name
System.out.println("File Name : " + outlookMessageAttachment.getLongFileName());
//Save attachment to the disk
outlookMessageAttachment.save(dataDir + outlookMessageAttachment.getDisplayName());
}
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.