Share via


SmtpMail.SmtpServer 属性

定义

获取或设置要用于发送电子邮件的 SMTP 中继邮件服务器的名称。 建议使用的替代项:System.Net.Mail

public:
 static property System::String ^ SmtpServer { System::String ^ get(); void set(System::String ^ value); };
public static string SmtpServer { get; set; }
static member SmtpServer : string with get, set
Public Shared Property SmtpServer As String

属性值

电子邮件中继服务器的名称。

示例

//This example assigns the name of the mail relay server on the 
//local network to the SmtpServer property.
SmtpMail.SmtpServer = "RelayServer.Contoso.com";
' This example assigns the name of the mail relay server on the 
' local network to the SmtpServer property.
SmtpMail.SmtpServer = "RelayServer.Contoso.com"

注解

如果 Windows 2000 和 Windows Server 2003) 随附的本地 SMTP 服务器 (位于阻止通过端口 25) (任何直接 SMTP 流量的防火墙后面,则需要了解网络上是否有可用于将 SMTP 消息中继到 Internet 的智能主机。

智能主机是一个 SMTP 服务器,具有从内部 SMTP 服务器将传出电子邮件直接中继到 Internet 的权限。 智能主机应能够同时连接到内部网络和 Internet,以便充当电子邮件网关。

适用于