SmtpMessage Property
Gets or sets the mail message which will be sent by the component on Send method call.

Namespace: MailBee.SmtpMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.3.1 build 666 for .NET 4.5
public MailMessage Message { get; set; }

Property Value

Type: MailMessage
The MailMessage object representing the mail message which will be sent by the component on Send method call.
MailBeeInvalidArgumentExceptionvalue is a null reference (Nothing in Visual Basic).

The developer can also use Message property to access those methods and properties of the message to be sent which are not available in Smtp class itself. For instance, LoadBodyText(String, MessageBodyType, Encoding, ImportBodyOptions) method is not available in Smtp class, and must be called as Smtp.Message.LoadBodyText(parameters).

Some most often used members of MailMessage object are available through Smtp class members. For instance, the following notations are equivalent: Smtp.Message.BodyHtmlText and Smtp.BodyHtmlText.

This sample composes the message by downloading the message body from a web page, and sends the message to a relay SMTP server (direct send mode is not used).
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.SmtpMail;
using MailBee.Mime;

// The actual code (put it into a method of your class)

Smtp mailer = new Smtp();

// Specify SMTP server to use. If your server does not require authentication, 
// just remove last 2 parameters.
mailer.SmtpServers.Add("", "jdoe", "secret");

// Compose the message.
mailer.From.AsString = "John Doe <>";
mailer.To.AsString = "Support Team <>";
mailer.Subject = "Error on your homepage";

mailer.Message.LoadBodyText("", MessageBodyType.Html);

// Send it.
See Also