SmtpServerCollectionAdd Method (String, Int32, Int32)
Initializes a new instance of the SmtpServer class with the given host name (or IP address string), port number and priority value, adds this instance into the collection, and sorts the collection according to the elements priorities.

Namespace: MailBee.SmtpMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.2.0 build 630 for .NET 4.5
public SmtpServer Add(
	string serverName,
	int serverPort,
	int priority


Type: SystemString
The host name or IP address string of the SMTP relay server to be added to the collection. The value cannot be a null reference (Nothing in Visual Basic).
Type: SystemInt32
The port on which to communicate with the SMTP relay server. The standard SMTP port is 25.
Type: SystemInt32
A preference of the SMTP relay server. Lower values are preferred.

Return Value

Type: SmtpServer
A reference to SmtpServer object which was created based on the given parameter values and then added to the collection.
MailBeeInvalidArgumentExceptionserverName is a null reference (Nothing in Visual Basic) or serverPort is an invalid port number.
It's recommended to add elements from higher priority to lower priority. Thus, the elements will stay in the same order as they were added.
See Also