Click or drag to resize

Smtp Class

SMTP client implementation. It allows sending emails using SMTP server.
Inheritance Hierarchy

Namespace:  Limilabs.Client.SMTP
Assembly:  Mail (in Mail.dll) Version: 3.0.23341.1754
Syntax
public class Smtp : ClientBase

The Smtp type exposes the following members.

Constructors
  NameDescription
Public methodSmtp
Initializes new instance of the Smtp class.
Public methodSmtp(AddressFamily)
Initializes new instance of the Smtp class.
Top
Properties
  NameDescription
Public propertyAllowPartialSending Obsolete.
Gets or sets the value indicating if SendMessage(IMail) and SendMessage(SmtpMail) should send message even if some recipients were rejected. Setting this value to true when Pipelining is used improves performance. Default is false.
Public propertyConfiguration
Gets or sets SMTP protocol configuration.
Public propertyConnected
Gets a value indicating whether the underlying Socket is connected to a remote host. This property makes a nonblocking, zero-byte Send call to determine the current state of the connection.
(Inherited from ClientBase.)
Public propertyCustomHost Obsolete.
Gets or sets the value, which, if set, is used when sending HELO or EHLO commands.
Public propertyDeliveryNotification Obsolete.
Gets or sets the delivery notification options (Delivery Status Notifications, DSN) for email. Available when DSN is reported by SupportedExtensions.
Public propertyDisableValidation Obsolete.
Gets or sets the value indicating if SmtpMail instance validation is performed before sending. It ensures that the message has a sender, at least one recipient and a body. Default is false.
Public propertyEnableChunking Obsolete.
Gets or sets the value indicating if Chunking should be used when sending messages. Default is true.
Public propertyEnablePipelining Obsolete.
Gets or sets the value indicating if Pipelining should be used when sending messages. Default is true.
Public propertyInstanceId
Gets a randomly generated unique id that identifies this instance.
(Inherited from ClientBase.)
Public propertyIsCompressed
Gets a Boolean value that indicates whether communication to the remote server is compressed. You can turn compression on by using Compress method.
(Inherited from ClientBase.)
Public propertyIsEncrypted
Gets a Boolean value that indicates whether communication to the remote server is encrypted.
(Inherited from ClientBase.)
Public propertyIsMutuallyAuthenticated
Gets a Boolean value that indicates whether communication to the remote server is mutually authenticated.
(Inherited from ClientBase.)
Public propertyIsSigned
Gets a Boolean value that indicates whether communication to the remote server is signed.
(Inherited from ClientBase.)
Public propertyReadStream
Gets underlying read stream for current connection.
(Inherited from ClientBase.)
Public propertyReceiveTimeout
Gets or sets the amount of time the underlying Socket will wait to receive data once a read operation is initiated.
(Inherited from ClientBase.)
Public propertySendTimeout
Gets or sets the amount of time the underlying Socket will wait for a send operation to complete successfully.
(Inherited from ClientBase.)
Public propertyServerGreeting
Gets the server greeting (initial response).
Public propertySocket
Gets the underlying Socket.
(Inherited from ClientBase.)
Public propertySSLConfiguration
Gets SSL/TLS configuration (client certificates, enabled SSL/TLS protocols).
(Inherited from ClientBase.)
Public propertyWriteStream
Gets underlying write stream for current connection.
(Inherited from ClientBase.)
Top
Methods
  NameDescription
Public methodAttach(Socket)
Attaches client to specified connected socket.
(Inherited from ClientBase.)
Public methodAttach(Socket, Boolean)
Attaches client to specified connected socket.
(Inherited from ClientBase.)
Public methodAttachSSL
Attaches client to specified connected socket.
(Inherited from ClientBase.)
Public methodBeginConnect(String)
Begins an asynchronous request for a remote server connection using DefaultPort.
Public methodBeginConnect(IPEndPoint, Boolean)
Begins an asynchronous request for a remote server connection.
(Inherited from ClientBase.)
Public methodBeginConnect(String, Int32)
Begins an asynchronous request for a remote server connection. You can use BeginConnectSSL(String, Int32) when SSL/TLS connection is needed.
(Inherited from ClientBase.)
Public methodBeginConnect(String, AsyncCallback)
Begins an asynchronous request for a remote server connection using DefaultPort.
Public methodBeginConnect(String, Int32, Boolean)
Begins an asynchronous request for a remote server connection.
(Inherited from ClientBase.)
Public methodBeginConnect(String, Int32, Boolean, AsyncCallback)
Begins an asynchronous request for a remote server connection.
(Inherited from ClientBase.)
Public methodBeginConnectSSL(String)
Begins an asynchronous request for a remote server secure connection using DefaultSSLPort and SSL/TLS.
Public methodBeginConnectSSL(String, Int32)
Begins an asynchronous request for a remote server secure connection using SSL/TLS.
(Inherited from ClientBase.)
Public methodBeginConnectSSL(String, AsyncCallback)
Begins an asynchronous request for a remote server secure connection using DefaultSSLPort and SSL/TLS.
Public methodBeginConnectSSL(String, Int32, AsyncCallback)
Begins an asynchronous request for a remote server secure connection using SSL/TLS.
(Inherited from ClientBase.)
Public methodClose
Sends QUIT command. Disconnects and releases all resources acquired by this object.
Public methodClose(Boolean)
Sends QUIT command. Disconnects and releases all resources acquired by this object.
Public methodCloseAsync
Sends QUIT command. Disconnects and releases all resources acquired by this object.
Public methodCloseAsync(Boolean)
Sends QUIT command. Disconnects and releases all resources acquired by this object.
Public methodConnect(String)
Connects to SMTP server on port 587. Use ConnectSSL(String) when SSL/TLS connection is needed.
Public methodConnect(IPEndPoint, Boolean)
Establishes connection to a remote server.
(Inherited from ClientBase.)
Public methodConnect(String, Int32)
Establishes connection to a remote server. You can use ConnectSSL(String, Int32) when SSL/TLS connection is needed.
(Inherited from ClientBase.)
Public methodConnect(IPAddress, Int32, Boolean)
Establishes connection to a remote server.
(Inherited from ClientBase.)
Public methodConnect(String, Int32, Boolean)
Establishes connection to a remote server.
(Inherited from ClientBase.)
Public methodConnectAsync(String)
Connects to SMTP server on port 587. Use ConnectSSL(String) when SSL/TLS connection is needed.
Public methodConnectAsync(IPEndPoint, Boolean)
Establishes connection to a remote server.
(Inherited from ClientBase.)
Public methodConnectAsync(String, Int32)
Establishes connection to a remote server. You can use ConnectSSL(String, Int32) when SSL/TLS connection is needed.
(Inherited from ClientBase.)
Public methodConnectAsync(IPAddress, Int32, Boolean)
Establishes connection to a remote server.
(Inherited from ClientBase.)
Public methodConnectAsync(String, Int32, Boolean)
Establishes connection to a remote server.
(Inherited from ClientBase.)
Public methodConnectSSL(String)
Connects to SMTP server using SSL/TLS on port 465.
Public methodConnectSSL(String, Int32)
Establishes connection to a remote server using SSL.
(Inherited from ClientBase.)
Public methodConnectSSLAsync(String)
Connects to SMTP server using SSL/TLS on port 465.
Public methodConnectSSLAsync(String, Int32)
Establishes connection to a remote server using SSL.
(Inherited from ClientBase.)
Public methodDispose
Releases all resources acquired by this object. Closes connection, without issuing any quit commands.
(Inherited from ClientBase.)
Protected methodDispose(Boolean)
Releases all resources acquired by this object. Closes connection, without issuing any quit commands.
(Inherited from ClientBase.)
Public methodEndConnect
Ends a pending asynchronous connection request.
(Inherited from ClientBase.)
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.)
Public methodLogin
Logs user in using AUTH LOGIN command. This method sends the password in clear text (BASE64), unless SSL/TLS connection is used.
Public methodLoginAsync
Logs user in using AUTH LOGIN command. This method sends the password in clear text (BASE64), unless SSL/TLS connection is used.
Public methodLoginCRAM
Logs user in using AUTH CRAM-MD5 command. This method does NOT send the password in clear text.
Public methodLoginCRAMAsync
Logs user in using AUTH CRAM-MD5 command. This method does NOT send the password in clear text.
Public methodLoginDIGEST(String, String)
Logs user in using AUTH DIGEST-MD5 command. This method does NOT send the password in clear text.
Public methodLoginDIGEST(String, String, String)
Logs user in using AUTH DIGEST-MD5 command. This method does NOT send the password in clear text.
Public methodLoginDIGESTAsync(String, String)
Logs user in using AUTH DIGEST-MD5 command. This method does NOT send the password in clear text.
Public methodLoginDIGESTAsync(String, String, String)
Logs user in using AUTH DIGEST-MD5 command. This method does NOT send the password in clear text.
Public methodLoginOAUTH
Logs user in using AUTH XOAUTH command. This method does NOT send the password. You can use OAuth class to create the key.
Public methodLoginOAUTH2
Logs user in using AUTH XOAUTH2 command. This method does NOT send the password. You can use DotNetOpenAuth to create the key. You can check which authentication methods remote server supports using SupportedAuthenticationMethods method.
Public methodLoginOAUTH2Async
Logs user in using AUTH XOAUTH2 command. This method does NOT send the password. You can use DotNetOpenAuth to create the key. You can check which authentication methods remote server supports using SupportedAuthenticationMethods method.
Public methodLoginOAUTHAsync
Logs user in using AUTH XOAUTH command. This method does NOT send the password. You can use OAuth class to create the key.
Public methodLoginPLAIN(String, String)
Logs user in using AUTH PLAIN command. This method sends the password in clear text (BASE64), unless SSL/TLS connection is used.
Public methodLoginPLAIN(String, String, String)
Logs user in using AUTH PLAIN command. This method sends the password in clear text (BASE64), unless SSL/TLS connection is used.
Public methodLoginPLAINAsync(String, String)
Logs user in using AUTH PLAIN command. This method sends the password in clear text (BASE64), unless SSL/TLS connection is used.
Public methodLoginPLAINAsync(String, String, String)
Logs user in using AUTH PLAIN command. This method sends the password in clear text (BASE64), unless SSL/TLS connection is used.
Public methodLoginSSPI
Logs user in using Negotiate mechanism. Target will be constructed as "smtp/" + TargetHost name.
Public methodLoginSSPI(SSPIMechanism)
Logs user in using specified mechanism (Negotiate, Kerberos or NTLM). Target will be constructed as "smtp/" + TargetHost name.
Public methodLoginSSPI(SSPIMechanism, String)
Logs user in using specified mechanism (Negotiate, Kerberos or NTLM).
Public methodLoginSSPI(SSPIMechanism, String, String)
Logs user in using specified mechanism (Negotiate, Kerberos or NTLM). Target will be constructed as "smtp/" + TargetHost name.
Public methodLoginSSPI(SSPIMechanism, String, String, String)
Logs user in using specified mechanism (Negotiate, Kerberos or NTLM).
Public methodLoginSSPIAsync
Logs user in using Negotiate mechanism. Target will be constructed as "smtp/" + TargetHost name.
Public methodLoginSSPIAsync(SSPIMechanism)
Logs user in using specified mechanism (Negotiate, Kerberos or NTLM). Target will be constructed as "smtp/" + TargetHost name.
Public methodLoginSSPIAsync(SSPIMechanism, String)
Logs user in using specified mechanism (Negotiate, Kerberos or NTLM).
Public methodLoginSSPIAsync(SSPIMechanism, String, String)
Logs user in using specified mechanism (Negotiate, Kerberos or NTLM). Target will be constructed as "smtp/" + TargetHost name.
Public methodLoginSSPIAsync(SSPIMechanism, String, String, String)
Logs user in using specified mechanism (Negotiate, Kerberos or NTLM).
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodNoop
Sends NOOP command to the server. It does nothing and always succeeds. Can be used to reset any inactivity auto-logout timer on the server.
Public methodNoopAsync
Sends NOOP command to the server. It does nothing and always succeeds. Can be used to reset any inactivity auto-logout timer on the server.
Public methodSend
Sends specified byte array to the server.
(Inherited from ClientBase.)
Public methodSendAsync
Sends specified byte array to the server.
(Inherited from ClientBase.)
Public methodSendCommand(String)
Sends command to the SMTP server (e.g. "EHLO").
Public methodSendCommand(String, Boolean)
Sends command to the SMTP server (e.g. "EHLO").
Public methodSendCommandAsync(String)
Sends command to the SMTP server (e.g. "EHLO").
Public methodSendCommandAsync(String, Boolean)
Sends command to the SMTP server (e.g. "EHLO").
Public methodSendMessage(IMail)
Sends a single email message.
Public methodSendMessage(SmtpMail)
Sends a single email message.
Public methodSendMessageAsync(IMail)
Sends a single message.
Public methodSendMessageAsync(SmtpMail)
Sends a single message.
Public methodStartTLS
Sends 'STARTTLS' command and initializes SSL/TLS connection (issues EHLO command afterwards). Not all servers support StartTLS. You can check which extensions remote server supports using SupportedExtensions method.
Public methodStartTLSAsync
Sends 'STARTTLS' command and initializes SSL/TLS connection (issues EHLO command afterward).
Public methodSupportedAuthenticationMethods
Lists authentication methods supported by the remote server.
Public methodSupportedExtensions
Lists extensions supported by the remote server (e.g. StartTLS)
Public methodTcpKeepAlive
Turns TCP protocol keep alive (SO_KEEPALIVE) option on.
(Inherited from ClientBase.)
Public methodTestMessageEnvelope(SmtpMail)
Sends message envelope to the SMTP server. Doesn't send or verify message contents. It can be used to verify if SMTP server accepts sender and recipient addresses.
Public methodTestMessageEnvelope(String, String)
Sends message envelope to the SMTP server. Doesn't send or verify message contents. It can be used to verify if SMTP server accepts sender and recipient addresses.
Public methodTestMessageEnvelopeAsync(SmtpMail)
Sends message envelope to the SMTP server. Doesn't send or verify message contents. It can be used to verify if SMTP server accepts sender and recipient addresses.
Public methodTestMessageEnvelopeAsync(String, String)
Sends message envelope to the SMTP server. Doesn't send or verify message contents. It can be used to verify if SMTP server accepts sender and recipient addresses.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodUseBestLogin
Logs user in using best method available. When no AUTH capability is found, this method switches to SSL/TLS (StartTLS) and tries again.
Public methodUseBestLoginAsync
Logs user in using best method available. When no AUTH capability is found, this method switches to SSL/TLS (StartTLS) and tries again.
Top
Events
  NameDescription
Public eventServerCertificateValidate
Event which is called for custom server certificate validation.
(Inherited from ClientBase.)
Top
Fields
  NameDescription
Public fieldStatic memberDefaultPort
Default SMTP protocol port (587). If you need to use different port please use port parameter in Connect(String, Int32) or Connect(String, Int32, Boolean) method.
Public fieldStatic memberDefaultSSLPort
Default SMTP protocol over SSL/TLS port (465). If you need to use different port please use port parameter in ConnectSSL(String, Int32) or Connect(String, Int32, Boolean) method.
Top
See Also