Smtp Capability Enumeration
A capability supported by an SMTP server.
Definition
Namespace: MailKit.Net.Smtp
Assembly: MailKit (in MailKit.dll) Version: 5.0.0
Assembly: MailKit (in MailKit.dll) Version: 5.0.0
C#
public enum SmtpCapabilityRemarks
Capabilities are read as part of the response to the EHLO command that
is issued during the connection phase of the SmtpClient.
Example
C#
public static void PrintCapabilities ()
{
using (var client = new SmtpClient ()) {
client.Connect ("smtp.gmail.com", 465, SecureSocketOptions.SslOnConnect);
if (client.Capabilities.Contains (SmtpCapability.Authentication)) {
var mechanisms = string.Join (", ", client.AuthenticationMechanisms);
Console.WriteLine ("The SMTP server supports the following SASL mechanisms: {0}", mechanisms);
client.Authenticate ("username", "password");
}
if (client.Capabilities.Contains (SmtpCapability.Size))
Console.WriteLine ("The SMTP server has a size restriction on messages: {0}.", client.MaxSize);
if (client.Capabilities.Contains (SmtpCapability.Dsn))
Console.WriteLine ("The SMTP server supports delivery-status notifications.");
if (client.Capabilities.Contains (SmtpCapability.EightBitMime))
Console.WriteLine ("The SMTP server supports Content-Transfer-Encoding: 8bit");
if (client.Capabilities.Contains (SmtpCapability.BinaryMime))
Console.WriteLine ("The SMTP server supports Content-Transfer-Encoding: binary");
if (client.Capabilities.Contains (SmtpCapability.UTF8))
Console.WriteLine ("The SMTP server supports UTF-8 in message headers.");
client.Disconnect (true);
}
}
Members
| Size | 0 | The server supports the SIZE extension and may have a maximum message size limitation (see MaxSize). |
| Dsn | 1 | The server supports the DSN extension, allowing clients to specify which (if any) recipients they would like to receive delivery notifications for. |
| EnhancedStatusCodes | 2 | The server supports the ENHANCEDSTATUSCODES extension. |
| Authentication | 3 | The server supports the AUTH extension, allowing clients to authenticate via supported SASL mechanisms. |
| EightBitMime | 4 | The server supports the 8BITMIME extension, allowing clients to send messages using the "8bit" Content-Transfer-Encoding. |
| Pipelining | 5 | The server supports the PIPELINING extension, allowing clients to send multiple commands at once in order to reduce round-trip latency. |
| BinaryMime | 6 | The server supports the BINARYMIME extension. |
| Chunking | 7 | The server supports the CHUNKING extension, allowing clients to upload messages in chunks. |
| StartTLS | 8 | The server supports the STARTTLS extension, allowing clients to switch to an encrypted SSL/TLS connection after connecting. |
| UTF8 | 9 | The server supports the SMTPUTF8 extension. |
| RequireTLS | 10 | The server supports the REQUIRETLS extension. |