SmtpAccess SmtpAccess SmtpAccess SmtpAccess Enum


Specifies the level of access allowed to a Simple Mail Transport Protocol (SMTP) server.

public enum class SmtpAccess
public enum SmtpAccess
type SmtpAccess = 
Public Enum SmtpAccess


Connect Connect Connect Connect 1

Connection to an SMTP host on the default port (port 25).

ConnectToUnrestrictedPort ConnectToUnrestrictedPort ConnectToUnrestrictedPort ConnectToUnrestrictedPort 2

Connection to an SMTP host on any port.

None None None None 0

No access to an SMTP host.


The following code example uses the SmtpAccess enumeration to create a permission object.

static SmtpPermission^ CreateConnectPermission()
    SmtpPermission^ connectAccess = 
        gcnew SmtpPermission(SmtpAccess::Connect);
    Console::WriteLine("Access? {0}", connectAccess->Access);
    return connectAccess;
public static SmtpPermission CreateConnectPermission()
    SmtpPermission connectAccess = new 
    Console.WriteLine("Access? {0}", connectAccess.Access);
    return connectAccess;


The SmtpAccess enumeration is used by the SmtpPermission and SmtpPermissionAttribute classes to specify a level of access to an SMTP host computer. The SmtpClient class demands an SmtpPermission when sending electronic mail to the SMTP host for delivery.

Applies to