Smtp Class
Namespace: Rebex.Net
Assembly: Rebex.Smtp.dll (version 7.0.9313)
Provides methods for communication with SMTP servers.
Syntax
public class Smtp : NetworkSession, ILogWriterProvider, IDisposable
Inherited Members
Remarks
All members of this class are thread-safe.
Constructors
| Name | Description |
|---|---|
| Smtp() | Initializes a new instance of the Smtp class. |
Fields
| Name | Description |
|---|---|
| AlternativeExplicitSslPort | Alternative SMTP/Explicit SSL port (587). |
| DefaultImplicitSslPort | Default SMTP/Implicit SSL port (465). |
| DefaultPort | Default SMTP port (25). |
Properties
| Name | Description |
|---|---|
| AbortTimeout | Gets or sets the length of time before the abort operation times out. |
| ClientDomain | Gets or sets the domain announced by the client. |
| DefaultLogWriter | Gets or sets a default log writer used by all new instances of NetworkSession object. Inherited from NetworkSession. |
| DeliveryStatusNotificationConditions | Gets or sets the bit field specifying the conditions under which the SMTP server should generate and send a delivery status notification (DSN) messages. |
| DeliveryStatusNotificationOriginalMessageMethod | Gets or sets the value indicating to the SMTP server whether it should attach the entire original message or headers only. |
| EnabledExtensions | Gets or sets the bit field specifying the enabled extensions. |
| Encoding | Gets or sets the Encoding to use to encode and decode command parameters and server responses. |
| InstanceId | Gets instance ID (intended for logging purposes). Inherited from NetworkSession. |
| IsAuthenticated | Returns a value indicating whether the session is authenticated. |
| IsBusy | Gets a value indicating whether there any operation (method) in progress. |
| IsConnected | Gets a value indicating whether the session is connected. |
| IsSecured | Gets the value indicating whether the control connection is secured. |
| LocalEndPoint | Gets the local client EndPoint. |
| LogWriter | Gets or sets the LogWriter used by this object. Inherited from NetworkSession. |
| MaxMailSize | Gets the maximum mail message size announced by the server. |
| Proxy | Gets or sets the network proxy to use to access a remote server. |
| RemoteEndPoint | Gets the remote server EndPoint. |
| ServerDomain | Gets the domain announced by the server. |
| ServerName | Gets the server name, if available. Inherited from NetworkSession. |
| ServerPort | Gets the server port, if available. Inherited from NetworkSession. |
| Settings | Gets or sets Smtp object settings. |
| State | Gets the current state of the Smtp object. |
| SupportedExtensions | Gets the bit field specifying the extensions supported by the server. |
| Timeout | Gets or sets the length of time in milliseconds before the operation times out (specify -1 or 0 to indicate that the request does not time out). |
| TlsSocket | Returns the TLS/SSL socket of secured control connection. |
| UserName | Gets the authenticated user name, if available. Inherited from NetworkSession. |
| Version | Returns the version of the SMTP component. |
Methods
| Name | Description |
|---|---|
| Abort() | Aborts the current operation. |
| CheckConnectionState() | Checks whether the SMTP session is still connected. Throws an exception on error. |
| Connect(String) | Connects to the SMTP server. |
| Connect(String, SslMode) | Connects to the SMTP server with the specified security. Uses port 25 for no SSL, 587 for explicit SSL and 465 for implicit SSL. |
| Connect(String, Int32) | Connects to the SMTP server. |
| Connect(String, Int32, SslMode) | Connects to the SMTP server with the specified security. |
| ConnectAsync(String, SslMode, Object) | Begins asynchronous Connect operation. Connects to the SMTP server with the specified security. Uses port 25 for no SSL, 587 for explicit SSL and 465 for implicit SSL. |
| ConnectAsync(String, Int32, SslMode, Object) | Begins asynchronous Connect operation. Connects to the SMTP server with the specified security. |
| ConnectAsync(String, Int32, Object) | Begins asynchronous Connect operation. Connects to the SMTP server. |
| ConnectAsync(String, Object) | Begins asynchronous Connect operation. Connects to the SMTP server. |
| Disconnect() | Informs the server that the connection is about to close and terminates the connection. |
| DisconnectAsync(Object) | Begins asynchronous Disconnect operation. Informs the server that the connection is about to close and terminates the connection. |
| Dispose() | Disposes the Smtp object and all the socket objects. |
| Dispose(Boolean) | Releases the unmanaged resources used by the Smtp and optionally releases the managed resources. |
| Finalize() | Finalizer. Called by garbage collector during object destruction. |
| GetConnectionState() | Checks whether the SMTP session is still connected and returns its state. |
| GetHashCode() | Gets hash code for this object. Inherited from NetworkSession. |
| GetSupportedAuthenticationMethods() | Gets the list of supported authentication methods. |
| KeepAlive() | Sends the NOOP command to the server to keep the connection alive. |
| KeepAliveAsync(Object) | Begins asynchronous KeepAlive operation. Sends the NOOP command to the server to keep the connection alive. |
| Login(GssApiProvider) | Authenticates the user to the SMTP server using the specified GSSAPI provider. Only supported on Windows and partially on Mono. |
| Login(SmtpAuthentication) | Authenticates the user to the SMTP server using the specified authentication method that does not require credentials (NTLM or GSSAPI). Only supported on Windows. |
| Login(String, SmtpAuthentication) | Authenticates the user to the SMTP server using an OAuth token. |
| Login(String, String) | Authenticates the user to the SMTP server. |
| Login(String, String, SmtpAuthentication) | Authenticates the user to the SMTP server using the specified authentication method. |
| LoginAsync(GssApiProvider, Object) | Begins asynchronous Login operation. Authenticates the user to the SMTP server using the specified GSSAPI provider. Only supported on Windows and partially on Mono. |
| LoginAsync(SmtpAuthentication, Object) | Begins asynchronous Login operation. Authenticates the user to the SMTP server using the specified authentication method that does not require credentials (NTLM or GSSAPI). Only supported on Windows. |
| LoginAsync(String, SmtpAuthentication, Object) | Begins asynchronous Login operation. Authenticates the user to the SMTP server using an OAuth token. |
| LoginAsync(String, String, SmtpAuthentication, Object) | Begins asynchronous Login operation. Authenticates the user to the SMTP server using the specified authentication method. |
| LoginAsync(String, String, Object) | Begins asynchronous Login operation. Authenticates the user to the SMTP server. |
| OnCommandSent(SmtpCommandSentEventArgs) | Raises the CommandSent event. |
| OnResponseRead(SmtpResponseReadEventArgs) | Raises the ResponseRead event. |
| OnStateChanged(SmtpStateChangedEventArgs) | Raises the StateChanged event. |
| OnTransferProgress(SmtpTransferProgressEventArgs) | Raises the TransferProgress event. |
| ReadResponse() | Returns the response of the SMTP server to the command. |
| ReadResponseAsync(Object) | Begins asynchronous ReadResponse operation. Returns the response of the SMTP server to the command. |
| ResolveDomainMX(String) | Retrieves the list of domain's MX records from DNS and returns the list of hosts that accept its email (in order of preference). |
| ResolveDomainMX(String, Int32) | Retrieves the list of domain's MX records from DNS and returns the list of hosts that accept its email (in order of preference). |
| Secure() | Secures the connection with TLS/SSL using default parameters. |
| SecureAsync(Object) | Begins asynchronous Secure operation. Secures the connection with TLS/SSL using default parameters. |
| Send(MailMessage) | Sends a mail message (MailMessage). |
| Send(MailMessage, SmtpConfiguration) | Sends the message using the specified SMTP server. |
| Send(MailMessage, String) | Sends the message using the specified SMTP server. |
| Send(MailMessage, String, Int32) | Sends the message using the specified SMTP server. |
| Send(MailMessage, String, String) | Sends a mail message (MailMessage). |
| Send(MimeMessage) | Sends a mail message (MimeMessage). |
| Send(MimeMessage, SmtpConfiguration) | Sends the message using the specified SMTP server. |
| Send(MimeMessage, String) | Sends the message using the specified SMTP server. |
| Send(MimeMessage, String, Int32) | Sends the message using the specified SMTP server. |
| Send(MimeMessage, String, String) | Sends a mail message (MimeMessage). |
| Send(Stream) | Reads and sends a mail message from the specified stream in MIME format. |
| Send(Stream, String, String) | Reads and sends a mail message from the specified stream in MIME format. |
| Send(String) | Reads and sends a mail message from the specified local file in MIME format. |
| Send(String, SmtpConfiguration) | Reads a mail message from the specified local file in MIME format and sends it using the specified SMTP server. |
| Send(String, String) | Reads a mail message from the specified local file in MIME format and sends it using the specified SMTP server. |
| Send(String, String, Int32) | Reads a mail message from the specified local file in MIME format and sends it using the specified SMTP server. |
| Send(String, String, String) | Reads and sends a mail message from the specified local file in MIME format. |
| Send(String, String, String, String) | Sends a mail message constructed from the specified parameters. |
| Send(String, String, String, String, SmtpConfiguration) | Sends a mail message constructed from the specified parameters using the specified SMTP server. |
| Send(String, String, String, String, String) | Sends a mail message constructed from the specified parameters using the specified SMTP server. |
| Send(String, String, String, String, String, Int32) | Sends a mail message constructed from the specified parameters using the specified SMTP server. |
| SendAsync(MailMessage, Object) | Begins asynchronous Send operation. Sends a mail message (MailMessage). |
| SendAsync(MailMessage, String, String, Object) | Begins asynchronous Send operation. Sends a mail message (MailMessage). |
| SendAsync(MimeMessage, Object) | Begins asynchronous Send operation. Sends a mail message (MimeMessage). |
| SendAsync(MimeMessage, String, String, Object) | Begins asynchronous Send operation. Sends a mail message (MimeMessage). |
| SendAsync(Stream, Object) | Begins asynchronous Send operation. Reads and sends a mail message from the specified stream in MIME format. |
| SendAsync(Stream, String, String, Object) | Begins asynchronous Send operation. Reads and sends a mail message from the specified stream in MIME format. |
| SendAsync(String, Object) | Begins asynchronous Send operation. Reads and sends a mail message from the specified local file in MIME format. |
| SendAsync(String, String, String, Object) | Begins asynchronous Send operation. Reads and sends a mail message from the specified local file in MIME format. |
| SendAsync(String, String, String, String, Object) | Begins asynchronous Send operation. Sends a mail message constructed from the specified parameters. |
| SendCommand(String) | Executes a command on the SMTP server. |
| SendCommandAsync(String, Object) | Begins asynchronous SendCommand operation. Executes a command on the SMTP server. |
| SendDirect(MailMessage) | Sends the message by submitting the message directly to the recipients' SMTP servers. |
| SendDirect(MimeMessage) | Sends the message by submitting the message directly to the recipients' SMTP servers. |
| SendDirect(String, String, String, String) | Sends a mail message constructed from the specified parameters by submitting it directly to the recipients' SMTP servers. |
| SetSocketFactory(ISocketFactory) | Sets the socket factory to be used to create communication sockets. |
| ToString() | Returns a string representation of this object. |
Events
| Name | Description |
|---|---|
| CommandSent | Occurs when a command is send to the server. |
| RejectedRecipient | Occurs when a recipient is rejected by the server. |
| ResponseRead | Occurs when a response is received from the server. |
| SendingMessage | Occurs when a message is sent. |
| StateChanged | Occurs when the state of the Smtp object is changed. |
| TransferProgress | Occurs when data is send or received. |
| ValidatingCertificate | Occurs when a server certificate needs to be validated. |