MailBee.NET Objects 3.1

Pop3.GetExtensions Method 

Returns a reference to the key-value list of the server capabilities.

public StringDictionary GetExtensions();

Return Value

The key-value list of the server capabilities, or a null reference (Nothing in Visual Basic) if the capabilities list is not available.

Remarks

You should already be connected to the POP3 server in order to use this method. If the server does not support CAPA command, the capabilities list will not be available. In this case, you can still try to call GetSupportedAuthMethods to get at least the list of supported authentication methods (AUTH command responsible for this is more widely supported than CAPA).

Note   If CAPA command has already been issued (for instance, this method has already been called or MailBee downloaded this list for its own purpose (such as to determine whether pipelining is supported by the server), this method will immediately return the cached results.

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.

Exceptions

Exception Type Condition
MailBeeException An error occurred and ThrowExceptions is true.

Example

This sample displays the list of all capabilities supported by the server.

[C#]
// To use the code below, import MailBee namespaces at the top of your code
using MailBee;
using MailBee.Pop3Mail;

// The actual code (put it into a method of your class)
Pop3 pop = new Pop3();
pop.Connect("mail.domain.com");
System.Collections.Specialized.StringDictionary caps = pop.GetExtensions();
if (caps == null)
{
    Console.WriteLine("The given POP3 server does not support CAPA command");
}
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);
        }
    }
}
pop.Disconnect();

// The output (the actual content will be different for a particular mail server).
user
top
stls
last
sasl LOGIN PLAIN CRAM-MD5 DIGEST-MD5 MSN NTLM
uidl
pipelining

In the output above, only "sasl" capability has parameters.
[Visual Basic]
' To use the code below, import MailBee namespaces at the top of your code.
Imports MailBee
Imports MailBee.Pop3Mail

' The actual code (put it into a method of your class).
Dim pop As New Pop3
pop.Connect("mail.domain.com")
Dim caps As System.Collections.Specialized.StringDictionary = pop.GetExtensions()
If caps Is Nothing Then
    Console.WriteLine("The given POP3 server does not support CAPA command")
Else
    Dim cap As String
    Dim val As String
    For Each cap In caps.Keys
        val = 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
pop.Disconnect()

' The output (the actual content will be different for a particular mail server).
user
top
stls
last
sasl LOGIN PLAIN CRAM-MD5 DIGEST-MD5 MSN NTLM
uidl
pipelining

In the output above, only "sasl" capability has parameters.

See Also

Pop3 Class | MailBee.Pop3Mail Namespace