Saves the HTML body of the message and all inline pictures and other inline objects to disk.
true if the body was successfully saved; otherwise, false.
All links to the embedded objects (pictures, CSS tables, etc) contained in the generated HTML file are automatically corrected to match the filenames assigned to these files when they were saved to disk.
By default, embedded objects are saved in the same folder where the HTML file resides. To store related files in another folder, set msg.Parser.WorkingFolder property prior to calling any method which can save related files.
You can also tell MailBee to automatically save the message as HTML file to disk when the message gets parsed by setting msg.Parser.AutoSaveHtmlMode = HtmlMessageAutoSaving.SaveMessageHtmAndRelatedFiles (assuming msg is MailMessage instance). Another option is using GetHtmlAndSaveRelatedFiles method and its overloads.
| Exception Type | Condition |
|---|---|
| MailBeeInvalidArgumentException | filename is a null reference (Nothing in Visual Basic) or an empty string. |
| MailBeeIOException | An I/O error occurred and ThrowExceptions is true. |
This sample loads the message from .EML file and generates HTML file containing the HTML body of this message.
[C#] // To use the code below, import MailBee namespaces at the top of your code. using MailBee; using MailBee.Mime; // The actual code (put it into a method of your class). MailMessage msg = new MailMessage(); msg.LoadMessage(@"C:\Docs\TestMail.eml"); msg.SaveHtmlAndRelatedFiles(@"C:\Temp\doc.htm");
[Visual Basic] ' To use the code below, import MailBee namespaces at the top of your code. Imports MailBee Imports MailBee.Mime ' The actual code (put it into a method of your class). Dim msg As New MailMessage msg.LoadMessage("C:\Docs\TestMail.eml") msg.SaveHtmlAndRelatedFiles("C:\Temp\doc.htm")
MailMessage Class | MailBee.Mime Namespace | GetHtmlAndSaveRelatedFiles