Επεξεργασία

Κοινή χρήση μέσω


SmtpAccess Enum

Definition

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
Inheritance
SmtpAccess

Fields

Name Value Description
None 0

No access to an SMTP host.

Connect 1

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

ConnectToUnrestrictedPort 2

Connection to an SMTP host on any port.

Examples

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
        SmtpPermission(SmtpAccess.Connect);
    Console.WriteLine("Access? {0}", connectAccess.Access);
    return connectAccess;
}

Remarks

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