SmtpServer Class
Represents an SMTP relay server to which the mail messages will be sent.
Inheritance Hierarchy
SystemObject
  MailBee.SmtpMailSmtpServer

Namespace: MailBee.SmtpMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
Syntax
[SerializableAttribute]
public class SmtpServer : ISortableByPriority

The SmtpServer type exposes the following members.

Constructors
  NameDescription
Public methodSmtpServer
Initializes a new instance of the SmtpServer class.
Public methodSmtpServer(String)
Initializes a new instance of the SmtpServer class with the given host name or IP address string, and assigns the top priority to this instance.
Public methodSmtpServer(String, Int32, Int32)
Initializes a new instance of the SmtpServer class with the given host name (or IP address string) and port number, and assigns the specified priority to this instance.
Public methodSmtpServer(String, String, String)
Initializes a new instance of the SmtpServer class with the given host name or IP address string, enables ESMTP authentication and assigns the top priority to this instance.
Public methodSmtpServer(String, String, String, AuthenticationMethods)
Initializes a new instance of the SmtpServer class with the given host name or IP address string, enables ESMTP authentication using the specified methods, and assigns the top priority to this instance.
Public methodSmtpServer(String, Int32, Int32, Int32, Boolean, AuthenticationMethods, String, String, Boolean, String, ExtendedSmtpOptions)
Initializes a new instance of the SmtpServer class with the given parameter values.
Public methodSmtpServer(String, Int32, Int32, Int32, Boolean, AuthenticationMethods, String, String, Boolean, String, ExtendedSmtpOptions, Int32, Int32, Int32)
Initializes a new instance of the SmtpServer class with the given parameter values.
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Properties
  NameDescription
Public propertyAccountDomain
Gets or sets the user domain name on the SMTP relay server.
Public propertyAccountName
Gets or sets the user account name on the SMTP relay server.
Public propertyAllowRefusedRecipients
Gets or sets whether refused recipients should be allowed when submitting a mail message to the server.
Public propertyAuthMethods
Gets or sets a set of authentication methods which can be used when authenticating the user on the server.
Public propertyAuthOptions
Gets or sets the options which alter ESMTP authentication process.
Public propertyAuthPopBeforeSmtp
Gets or sets whether the Smtp component should perform POP-before-SMTP authentication prior to connecting to the SMTP server.
Public propertyAuthUserDefined
Gets or sets a reference to the instance of a class implementing custom SASL authentication mechanism.
Public propertyHelloDomain
Gets or sets the string to be supplied as an argument of HELO/EHLO commands, or a null reference (Nothing in Visual Basic) to let MailBee autodetect the correct value (see Hello for details).
Public propertyIgnoreLoginFailure
Gets or sets whether the Smtp component should ignore ESMTP or POP-before-SMTP authentication error (if any) and still attempt to send the message.
Public propertyLocalEndPoint
Gets or sets the local end point which will be used when connecting to the SMTP server.
Public propertyMaxConnectionCount
Gets or sets the maximum number of simultaneous connections to this SMTP server in multi-thread sending mode.
Public propertyMaxSendPerSessionCount
Gets or sets the maximum number of e-mail messages which can be sent within a single connection with the server.
Public propertyName
Gets or sets the host name or IP address string of the SMTP relay server.
Public propertyPassword
Gets or sets the user account password on the SMTP relay server.
Public propertyPauseInterval
Gets or sets the amount of time MailBee must wait prior to connecting to the server after last disconnection from this server.
Public propertyPipelining
Gets or sets whether to use commands pipelining if it's supported by the server.
Public propertyPort
Gets or sets the port number on which to communicate with the SMTP relay server.
Public propertyPriority
Gets or sets the usage preference of this SMTP relay server as compared to preferences of other servers in SmtpServers and DnsServers collections.
Public propertyCode exampleProxy
Provides access to the settings which allow MailBee to connect to a mail server via a proxy server.
Public propertySmtpOptions
Gets or sets the options which can be used to disable certain extended SMTP capabilities.
Public propertyCode exampleSslCertificates
Provides access to the client and server SSL certificate settings.
Public propertyCode exampleSslMode
Gets or sets how the component should establish TLS/SSL connection with the mail server.
Public propertySslProtocol
Gets or sets the security protocol to be used for performing TLS/SSL negotiation and data encryption.
Public propertyTargetName
Gets or sets the target name (Service Principal Name, SPN) of the SMTP relay server.
Public propertyTimeout
Gets or sets the amount of time (in milliseconds) the Smtp component will wait for a response from this server.
Top
Remarks

This class is used to specify an SMTP relay server the mail messages should be submitted to. Another type of SMTP server is SMTP MX server which is a server which accepts mail for a particular domain. When the mail message is submitted to SMTP relay server, the relay server performs the following operations:

  • The message is received from the client
  • For each recipient e-mail address, the domain part is extracted, and duplicates are removed (example: for user1@domain1.com, user2@domain1.com, user1@domain2.com, user3@domain1.com), the list of unique domains is domain1.com, domain2.com)
  • For each of the unique domains, DNS MX lookup query is sent to the DNS server
  • For each domain, the DNS server returns the list of SMTP MX servers which accept mail for this domain
  • The relay server then relays the mail message to SMTP MX server of each domain
In other words, SMTP relay server dispatches the mail message received from the client, to the SMTP MX servers of the target recipients.

To specify SMTP relay server in your application, call mailer.SmtpServers.Add method (assuming mailer is an instance of Smtp class).

Note Note
When MailBee is used in direct send mode (by performing DNS MX lookup against DNS servers in DnsServers collection), MailBee itself acts as SMTP relay server, and dispatches the mail message to the MX servers of recipients domains.
Examples
Another example of specifying SMTP relay server in the application is available at SslMode topic.
See Also