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.5.0 build 687 for .NET 4.5
Syntax
public SmtpServer Add(
	string serverName,
	int serverPort,
	int priority
)

Parameters

serverName
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).
serverPort
Type: SystemInt32
The port on which to communicate with the SMTP relay server. The standard SMTP port is 25.
priority
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.
Exceptions
ExceptionCondition
MailBeeInvalidArgumentExceptionserverName is a null reference (Nothing in Visual Basic) or serverPort is an invalid port number.
Remarks
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