MailMessageSaveHtmlAndRelatedFiles Method
Saves the HTML body of the message and all inline pictures and other inline objects to disk.

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

Parameters

filename
Type: SystemString
The HTML file to be written to.

Return Value

Type: Boolean
true if the body was successfully saved; otherwise, false.
Exceptions
ExceptionCondition
MailBeeInvalidArgumentExceptionfilename is a null reference (Nothing in Visual Basic) or an empty string.
MailBeeIOExceptionAn I/O error occurred and ThrowExceptions is true.
Remarks

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.

If you're getting non-Latin characters not being displayed correctly in resulting HTML files, consider setting WriteUtf8ByteOrderMark to true (like in the sample code below).

Examples
This sample loads the message from .EML file and generates HTML file containing the HTML body of this message.
// 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.Parser.WriteUtf8ByteOrderMark = true;
msg.SaveHtmlAndRelatedFiles(@"C:\Temp\doc.htm");
See Also