CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2013
    Posts
    83

    Convert Microsoft Outlook MSG Email Message to PDF File

    This technical tip explains how to convert an email message to PDF using Aspose.Email. Aspose.Email for .NET deals with network protocols and Microsoft Outlook features, and cannot handle direct conversion to PDF. To overcome this, the samples in this article use Aspose.Email to convert the email message to MHTML stream and then use Aspose.Words for .NET to load the MHTML stream and then save it as PDF. The following code shows converting email message to PDF using Aspose.Email in combination with Aspose.Words for .NET. This involves the following steps:

    1. Load the email message using MailMessage
    2. Save the email message to MemoryStream as MHTML
    3. Load the stream using Aspose.Words
    4. Save the message as PDF


    Sample Code for Converting an Email Message to PDF


    [C#]

    Code:
    MailMessagemailMsg = MailMessage.Load("About Aspose-1.msg");
    
    MemoryStreamms = new MemoryStream();
    
    //Save as MHTML
    mailMsg.Save(ms, MailMessageSaveType.MHtmlFromat);
    
    //create an instance of LoadOptions and set the LoadFormat to Mhtml
    varloadOptions = new Aspose.Words.LoadOptions();
    loadOptions.LoadFormat = LoadFormat.Mhtml;
    
    //create an instance of Document and load the MTHML from MemoryStream
    var document = new Aspose.Words.Document(ms, loadOptions);
    
    //create an instance of HtmlSaveOptions and set the SaveFormat to Html
    varsaveOptions = new Aspose.Words.Saving.PdfSaveOptions();
    
    //save the document to Html file
    document.Save("About Aspose.pdf", saveOptions);

    [VB.NET]

    Code:
    Dim mailMsg As MailMessage = MailMessage.Load("About Aspose-1.msg")
    
    Dim ms As New MemoryStream()
    
    'Save as MHTML
    mailMsg.Save(ms, MailMessageSaveType.MHtmlFromat)
    
    'create an instance of LoadOptions and set the LoadFormat to Mhtml
    Dim loadOptions = New Aspose.Words.LoadOptions()
    loadOptions.LoadFormat = LoadFormat.Mhtml
    
    'create an instance of Document and load the MTHML from MemoryStream
    Dim document = New Aspose.Words.Document(ms, loadOptions)
    
    'create an instance of HtmlSaveOptions and set the SaveFormat to Html
    Dim saveOptions = New Aspose.Words.Saving.PdfSaveOptions()
    
    'save the document to Html file
    document.Save("About Aspose.pdf", saveOptions);

  2. #2
    Join Date
    Sep 2014
    Posts
    1

    Re: Convert Microsoft Outlook MSG Email Message to PDF File

    Total Mail Converter will help you to convert MSG to PDF in batches, hundreds of thousands of them at a time. When batch processing, it's crucial to have flexible settings. Total Mail Converter provides everything to get the output PDF files the way you need.

    For example, it will give descriptive names to output files and attachments. This way you will always know which attachment refers to which email.

    Or it can embed attachments into the final PDF. Then the header of the PDF will contain the filename of the attachment. In a PDF viewer this is a clickable link that will open the attachment in its associated program.

    Some people prefer to combine several MSG files into one multi-page PDF. Total Mail Converter can do that, just tick the appropriate checkbox in the wizard of the program.

    Need to sign PDF files? Just locate your PFX file and the program will add the digital signature to the converted emails. Both PDF and PDF/A formats are supported.


    Download the free trial version and convert MSG to PDF for 30 days. Quite enough time to see how it works!

  3. #3
    Join Date
    Feb 2017
    Posts
    1

    Re: Convert Microsoft Outlook MSG Email Message to PDF File

    Hi,

    is it possible to also save/include attachments in the email as PDF?
    (depending on the attachment format of couse)

  4. #4
    Join Date
    Feb 2017
    Posts
    3

    Re: Convert Microsoft Outlook MSG Email Message to PDF File

    It's quite easy to convert MSG to PDF format, and you don't need to use any paid software for that. Just go to Zamzar.com site, upload the MSG file, select the output format PDF and provide your email ID where you would receive the output file. After that, you download the file.

  5. #5
    Join Date
    Apr 2017
    Posts
    3

    Re: Convert Microsoft Outlook MSG Email Message to PDF File

    If you have multiple MSG files then any free tool or online tool is not going to help anyway. I would recommend you to go for a paid msg to pdf tool. It can not just help in conversion but ensures that you will not lose any details from the emails.

    Check it out here: https://gallery.technet.microsoft.co...Files-cff1cae1

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured