SmtpMessage Property |
Namespace: MailBee.SmtpMail
Exception | Condition |
---|---|
MailBeeInvalidArgumentException | value 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.
// 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("smtp.domain.com", "jdoe", "secret"); // Compose the message. mailer.From.AsString = "John Doe <jdoe@domain.com>"; mailer.To.AsString = "Support Team <support@afterlogic.com>"; mailer.Subject = "Error on your homepage"; mailer.Message.LoadBodyText("http://www.afterlogic.com", MessageBodyType.Html); // Send it. mailer.Send();