| SmtpCapabilities Enumeration |
Capabilities supported by an SMTP server.
Namespace: MailKit.Net.SmtpAssembly: MailKit (in MailKit.dll) Version: 4.7.1
Syntax [FlagsAttribute]
public enum SmtpCapabilities
Members Member name | Value | Description |
---|
None | 0 |
The server does not support any additional extensions.
|
Size | 1 |
The server supports the SIZE extension
and may have a maximum message size limitation (see MaxSize).
|
Dsn | 2 |
The server supports the DSN extension,
allowing clients to specify which (if any) recipients they would like to receive delivery
notifications for.
|
EnhancedStatusCodes | 4 |
The server supports the ENHANCEDSTATUSCODES
extension.
|
Authentication | 8 |
The server supports the AUTH extension,
allowing clients to authenticate via supported SASL mechanisms.
|
EightBitMime | 16 |
The server supports the 8BITMIME extension,
allowing clients to send messages using the "8bit" Content-Transfer-Encoding.
|
Pipelining | 32 |
The server supports the PIPELINING extension,
allowing clients to send multiple commands at once in order to reduce round-trip latency.
|
BinaryMime | 64 |
The server supports the BINARYMIME extension.
|
Chunking | 128 |
The server supports the CHUNKING extension,
allowing clients to upload messages in chunks.
|
StartTLS | 256 |
The server supports the STARTTLS extension,
allowing clients to switch to an encrypted SSL/TLS connection after connecting.
|
UTF8 | 512 |
The server supports the SMTPUTF8 extension.
|
RequireTLS | 1,024 |
The server supports the REQUIRETLS extension.
|
Remarks
Capabilities are read as part of the response to the EHLO command that
is issued during the connection phase of the
SmtpClient.
Example public static void PrintCapabilities ()
{
using (var client = new SmtpClient ()) {
client.Connect ("smtp.gmail.com", 465, SecureSocketOptions.SslOnConnect);
if (client.Capabilities.HasFlag (SmtpCapabilities.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.HasFlag (SmtpCapabilities.Size))
Console.WriteLine ("The SMTP server has a size restriction on messages: {0}.", client.MaxSize);
if (client.Capabilities.HasFlag (SmtpCapabilities.Dsn))
Console.WriteLine ("The SMTP server supports delivery-status notifications.");
if (client.Capabilities.HasFlag (SmtpCapabilities.EightBitMime))
Console.WriteLine ("The SMTP server supports Content-Transfer-Encoding: 8bit");
if (client.Capabilities.HasFlag (SmtpCapabilities.BinaryMime))
Console.WriteLine ("The SMTP server supports Content-Transfer-Encoding: binary");
if (client.Capabilities.HasFlag (SmtpCapabilities.UTF8))
Console.WriteLine ("The SMTP server supports UTF-8 in message headers.");
client.Disconnect (true);
}
}
See Also