MailMessageGetHtmlAndSaveRelatedFiles Method
Extracts the HTML body of the message, saves the attached inline pictures and other related files to disk, and return the modified HTML body.

Namespace: MailBee.Mime
Assembly: MailBee.NET.45 (in MailBee.NET.45.dll) Version: 10.0.45.502
Syntax
public string GetHtmlAndSaveRelatedFiles()

Return Value

Type: String
A string containing the HTML body which is altered in such a way so that all Content-ID references (cid:) are replaced with paths to the related files as they were saved by this method.
Remarks
The inline objects referenced in the HTML body of the message (i.e. embedded objects) are saved into the folder denoted by MailMessage.Parser.WorkingFolder property. The links to the embedded objects in the returned HTML data are corrected automatically. The value of BodyHtmlText property is left intact.
Examples
This sample creates an HTML file from the e-mail message. The related files will also be saved into the same location.
Note Note
You can also use SaveHtmlAndRelatedFiles(String) method to save messages as HTML pages.
using System.IO;
using MailBee;
using MailBee.Mime;

class Sample
{
    static void Main(string[] args)
    {
        // Load the message from file.
        MailMessage msg = new MailMessage();
        msg.LoadMessage(@"C:\Docs\TestMail.eml");

        // Set the folder where all related files should be saved.
        msg.Parser.WorkingFolder = @"C:\Temp";

        // Generate an HTML file.
        using (StreamWriter sw = new StreamWriter(@"C:\Temp\web_page.htm", false))
        {
            sw.Write(msg.GetHtmlAndSaveRelatedFiles());
        }
    }
}
See Also