MailBee.NET Objects 3.1

Smtp.GetExtension Method 

Returns the name or parameters of the specified ESMTP capability.

public string GetExtension(
   string name
);

Parameters

name
The name of the capability.

Return Value

If the specified capability is parameterless, the return value is the name of the capability itself. If the capability has parameters, the return value is a string which contains the parameters list as returned by the server. If the server does not support ESMTP (see GetExtensions for more information) or the given capability is not supported, the return value is a null reference (Nothing in Visual Basic).

Remarks

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 will not be available.

Exceptions

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.

Example

This sample displays whether the server supports ESMTP pipelining.

[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();
string ext = mailer.GetExtension("pipelining");
if (ext == null)
{
    Console.WriteLine("The given server does not support ESMTP pipelining");
}
else
{
    Console.WriteLine("ESMTP Pipelining is supported");
}
mailer.Disconnect();
[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 ext As String = mailer.GetExtension("pipelining")
If ext Is Nothing Then
    Console.WriteLine("The given server does not support ESMTP pipelining")
Else
    Console.WriteLine("ESMTP Pipelining is supported")
End If
mailer.Disconnect()

See Also

Smtp Class | MailBee.SmtpMail Namespace