Returns a reference to the key-value list of the server capabilities.
The key-value list of the server capabilities, or a null reference (Nothing in Visual Basic) if the capabilities list is not available.
In order to use this method, the connection with the SMTP server must already be established, and Hello method already called.
Note If the server does not support EHLO command (i.e. the server is not ESMTP enabled), the capabilities list will not be available.
In the returned StringDictionary, each key is a capability name (always lowercase). Its value is either empty string (if the capability has no parameters) or space-delimited list of the parameters.
| Exception Type | Condition |
|---|---|
| MailBeeInvalidStateException | There are multiple or non-SMTP connections being opened at the moment (IsSmtpContext is false). |
| MailBeeException | An error occurred and ThrowExceptions is true. |
This sample displays the list of all capabilities supported by the server.
[C#] // To use the code below, import these namespaces at the top of your code. using System; using MailBee; using MailBee.SmtpMail; // The actual code (put it into a method of your class) Smtp mailer = new Smtp(); mailer.SmtpServers.Add("mail.domain.com"); mailer.Connect(); mailer.Hello(); System.Collections.Specialized.StringDictionary caps = mailer.GetExtensions(); if (caps == null) { Console.WriteLine("The given SMTP server does not support any ESMTP extensions"); } else { foreach (string cap in caps.Keys) { string val = caps[cap]; if (val != string.Empty) { // Print capability name and parameters. Console.WriteLine(cap + " " + val); } else { // For parameterless capabilities, print capability name only. Console.WriteLine(cap); } } } mailer.Disconnect(); // The output (the actual content will be different for a particular mail server) dsn size auth LOGIN PLAIN ehlo auth=login starttls help pipelining In the output above, only "auth" capability has parameters. Note: auth=login is a single name, while "auth LOGIN PLAIN" denotes auth capability having two parameters (LOGIN and PLAIN).
[Visual Basic] ' To use the code below, import MailBee namespaces at the top of your code Imports MailBee Imports MailBee.SmtpMail ' The actual code (put it into a method of your class). Dim mailer = New Smtp mailer.SmtpServers.Add("mail.domain.com") mailer.Connect() mailer.Hello() Dim caps As System.Collections.Specialized.StringDictionary = mailer.GetExtensions() If caps Is Nothing Then Console.WriteLine("The given SMTP server does not support any ESMTP extensions") Else For Each cap As String In caps.Keys Dim val As String = caps(cap) If (val <> String.Empty) Then ' Print capability name and parameters. Console.WriteLine(cap + " " + val) Else ' For parameterless capabilities, print capability name only. Console.WriteLine(cap) End If Next End If mailer.Disconnect() ' The output (the actual content will be different for a particular mail server) dsn size auth LOGIN PLAIN ehlo auth=login starttls help pipelining In the output above, only "auth" capability has parameters. Note: auth=login is a single name, while "auth LOGIN PLAIN" denotes auth capability having two parameters (LOGIN and PLAIN).
Smtp Class | MailBee.SmtpMail Namespace