Loads the contents of the specified file into HTML or plain-text body of the message.
true if the text was successfully imported; otherwise, false.
This method does not automatically attach pictures and other files referenced in the HTML content being imported. Use ImportRelatedFiles method or LoadBodyText for this. The latter can also be used to load HTML body from a web location rather than from local filesystem.
| 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 creates a new message and loads HTML body from .HTM file.
[C#] // 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");
[Visual Basic] ' To use the code below, import MailBee namespaces at the top of your code. Imports MailBee Imports MailBee.Mime Dim msg As New MailMessage msg.LoadBodyText("C:\Temp\web_page.htm", MessageBodyType.Html) msg.SaveMessage("C:\Temp\msg.eml")
MailMessage Class | MailBee.Mime Namespace | MailMessage.LoadBodyText Overload List | ImportRelatedFiles | Builder