MailMessageLoadBodyText Method (String, MessageBodyType)
Loads the contents of the specified file into HTML or plain-text body of the message.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax
public bool LoadBodyText(
	string filename,
	MessageBodyType bodyType
)

Parameters

filename
Type: SystemString
The absolute or relative path to the file containing the text to be imported.
bodyType
Type: MailBee.MimeMessageBodyType
Denotes whether to load the data into HTML body or into plain-text body.

Return Value

Type: Boolean
true if the text was successfully imported; 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
This method does not automatically attach pictures and other files referenced in the HTML content being imported. Use ImportRelatedFiles(ImportRelatedFilesOptions) method or LoadBodyText(String, MessageBodyType, Encoding, ImportBodyOptions) for this. The latter can also be used to load HTML body from a web location rather than from local filesystem.
Examples
This sample creates a new message and loads HTML body from .HTM file.
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.Mime;

MailMessage msg = new MailMessage();
msg.LoadBodyText(@"C:\Temp\web_page.htm", MessageBodyType.Html);
msg.SaveMessage(@"C:\Temp\msg.eml");
See Also