We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Outlook Emails to Pdf

Hi

I can see, that this topic has been seen before...

Anyway, it's difficult to find an answer that helps me. Many answers are outdated because of newer releases...

So, do you have an actual solution for this problem?

I would like to convert an Outlook Email to Pdf (if possible containing images)...

Kind regards, Karit :)

Hi Karit,


Thank you for your inquiry.

You can convert an Outlook message to PDF by using the collaboration of Aspose.Email and Aspose.Words for .NET components. Below is the sample source and attached are my input and output files for your reference.

C#

var message = Aspose.Email.Mail.MailMessage.Load(“sample.msg”);
using (var msgStream = new MemoryStream())
{
message.Save(msgStream, Aspose.Email.Mail.MailMessageSaveType.MHtmlFromat);
msgStream.Position = 0;
var options = new Aspose.Words.LoadOptions();
options.LoadFormat = Aspose.Words.LoadFormat.Mhtml;
var document = new Aspose.Words.Document(msgStream, options);
document.Save(“output.pdf”, new Aspose.Words.Saving.PdfSaveOptions());
}

Great! Thank you. What about attachments? Can I append them to the document?

Hi Karit,


Thank you for your feedback.

I am afraid, at the moment you can not add regular attachments to the MHTML file produced by Aspose.Email for .NET component. I will check back with development team if we can add this feature to our roadmap.

Once Aspose.Email component provides the required implementation, you may have to check with the experts of Aspose.Words to know how they will handle the attachments (regular) in MHTML to PDF conversion process.

Regards,

Can i add attachments to PDF, i am able to save email message as pdf, i want to include attachments also.

Hi Naveen,


Thank you for considering Aspose.Email.

Aspose.Email can add linked Resources embedded in an email while converting to MHTML (later on used for conversion to PDF using Aspose.Words), but doesn’t support adding regular attachments to the MHTML during conversion. For example, if the html body contains a reference to some image, it will be saved to mhtml. But if this image is just a regular attachment, it won’t be added to the MHTMl, and hence won’t be part of the PDF as well.

is there also a java example for getting the msg file as an input stream

and convert it to pdf outputstream?

Hi Gil,


Please refer to your post here for detail answer to your question.

any update on this?? can i convert an email body and the attachments in one pdf file?

Hi,


Thank you for posting your query.

Aspose.Email API doesn’t have the capability to process regular email attachments and make them part of the output MHTML file. Only inline contents can be made part of the output MHTML. Please feel free to write to us if you have further query about this requirement.