SmtpSmtpServers Property
Gets the SmtpServerCollection object containing the list of SMTP relay servers to be used for sending mail.

Namespace: MailBee.SmtpMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.4 build 677 for .NET 4.5
Syntax
public SmtpServerCollection SmtpServers { get; }

Property Value

Type: SmtpServerCollection
The SmtpServerCollection object containing the list of SMTP servers to be used for sending mail.
Remarks

In order to send mail to an SMTP server, the developer must add it to SmtpServers collection first.

SmtpServers collection can contain multiple servers, which allows the developer to implement reliable send mail solution. In this case, SmtpServer having the highest priority (i.e. the lowest Priority value) will be tried first. If it fails, other servers will be tried accordingly their priority values.

SmtpServers collection can be used in cooperation with DnsServers collection. Depending which collection's top priority server has higher priority than another collection's top priority server, MailBee will either try to send to relay SMTP servers first and use direct send (through DNS MX lookup) if SMTP relay failed, or try to send in direct mode first, and use SMTP relay as a backup. This approach can be used if the application is mission-critical, and failures are not allowed.

Examples
This sample sends a mail message to an SMTP relay server. SMTP authentication is enabled, but IgnoreLoginFailure is set to true to force MailBee to try to send even if authentication fails.
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.SmtpMail;

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

Smtp mailer = new Smtp();

// Specify SMTP server to use, and enable SMTP authentication.
mailer.SmtpServers.Add("smtp.company.com", "john.doe@company.com", "secret");

// Tune some settings of the server just added.
mailer.SmtpServers[0].IgnoreLoginFailure = true;

// Compose the message.
mailer.Message.From.DisplayName = "John Doe";
mailer.Message.From.Email = "john.doe@company.com";
mailer.Message.To.Add("Bill Smith", "bill@i-am-bill-smith.com");
mailer.Subject = "Your order";
mailer.BodyPlainText = "Purchased item description";

// Send it.
mailer.Send();
See Also