SmtpAccess 枚举

定义

指定允许的简单邮件传输协议 (SMTP) 服务器访问级别。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
继承
SmtpAccess

字段

Connect 1

连接到默认端口(端口 25)上的 SMTP 主机。Connection to an SMTP host on the default port (port 25).

ConnectToUnrestrictedPort 2

连接到任何端口上的 SMTP 主机。Connection to an SMTP host on any port.

None 0

不能访问 SMTP 主机。No access to an SMTP host.

示例

下面的代码示例使用SmtpAccess枚举创建权限对象。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;
}

注解

SmtpPermission SmtpAccessSmtpPermissionAttribute类使用枚举来指定对 SMTP 主机计算机的访问级别。The SmtpAccess enumeration is used by the SmtpPermission and SmtpPermissionAttribute classes to specify a level of access to an SMTP host computer. 当向 SMTP 主机发送电子邮件以进行传递时, SmtpClient类需要。 SmtpPermissionThe SmtpClient class demands an SmtpPermission when sending electronic mail to the SMTP host for delivery.

适用于