MailBee.NET Objects 3.1

MessageBuilderConfig Class

Provides properties and methods which affect how the mail message is being built from the MailMessage object properties and collections into the message raw data (in MIME format).

For a list of all members of this type, see MessageBuilderConfig Members.

System.Object
   MailBee.Mime.MessageBuilderConfig

public class MessageBuilderConfig

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

This class allows the developer to tune how a new mail message will be generated from MailMessage properties and collections. This may include automatic creation of plain-text version of the HTML body, setting Date and MessageID values, and much more. A new mail message is a message created with MailBee.

To tune how an existing mail message should be being parsed, use MailMessage.Parser property. An existing mail message is a message received from another source (such as file, stream, mail server, etc).

A message can be both existing and new. For instance, if you have received a message from the mail server (this makes this message existing), modified it and are re-sending it again. This will produce a new message (although it's based on another existing message).

Note   MessageBuilderConfig object cannot be used on its own. To access its members, use MailMessage.Builder property.

Example

The sample creates a new message, enables automatic creation of the plain-text version of the HTML body, and saves the message to disk.

[C#]
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.Mime;

// Create a new MailMessage object.
MailMessage msg = new MailMessage();

// Tell MailBee to create plain-text version of the HMTL body.
msg.Builder.HtmlToPlainMode = HtmlToPlainAutoConvert.IfNoPlain;

// Set the HTML body contents.
msg.BodyHtmlText = @"<html><b>Hello</b>, <i>World</i>!</html>";

// Save the message into a folder. The plain-text version will be
// created at this point along with generating MIME source of the message.
msg.SaveMessage(@"C:\Temp\TestMail.eml");
[Visual Basic]
' To use the code below, import MailBee namespaces at the top of your code.
Imports MailBee
Imports MailBee.Mime

' Create a new MailMessage object.
Dim msg As New MailMessage

' Tell MailBee to create plain-text version of the HMTL body.
msg.Builder.HtmlToPlainMode = HtmlToPlainAutoConvert.IfNoPlain

' Set the HTML body contents.
msg.BodyHtmlText = "<html><b>Hello</b>, <i>World</i>!</html>"

' Save the message into a folder. The plain-text version will be
' created at this point along with generating MIME source of the message.
msg.SaveMessage("C:\Temp\TestMail.eml")

Requirements

Namespace: MailBee.Mime

Assembly: MailBee.NET (in MailBee.NET.dll)

See Also

MessageBuilderConfig Members | MailBee.Mime Namespace | MailMessage | Builder | Parser