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.2.0 build 630 for .NET 4.5
public bool LoadBodyText(
	string filename,
	MessageBodyType bodyType


Type: SystemString
The absolute or relative path to the file containing the text to be imported.
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.
MailBeeInvalidArgumentExceptionfilename is a null reference (Nothing in Visual Basic) or an empty string.
MailBeeIOExceptionAn I/O error occurred and ThrowExceptions is true.
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.
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);
See Also