【发布时间】:2012-06-02 08:41:05
【问题描述】:
我的代码使用 System.Net.Mail.MailMessage 通过 smtp.gmail.com 在端口 587 上发送电子邮件。当我在装有 Windows 7 的计算机上通过 IIS 运行此代码时,它可以工作。电子邮件已发送,并且到达。
在 Windows Server 2008 上的 IIS 上运行的完全相同的代码不起作用。一切都保持不变,唯一的区别是操作系统。它们都在同一个网络上运行,所以这不是路由器安全问题。我试图禁用端口 587 上的传出防火墙,但没有奏效。我已尝试在以下两个问题中应用答案,但也没有奏效:
Sending email through a Google Apps account is working locally, but not on my web server
c# SmtpClient class not able to send email using gmail
有人知道 Windows Server 上的什么安全设置阻止我发送电子邮件吗?
我得到的错误: 无法解析远程名称:'smtp.gmail.com'
【问题讨论】:
-
主机名可以解析吗?打开命令提示符并输入 nslookup smtp.gmail.com
-
只是一个健全性检查:ping smtp.gmail.com 是否产生结果?
-
nslookup smtp.gmail.com 不起作用。响应是“UnKnown can't find smtp.gmail.com: No response from server”
-
ping smtp.gmail.com 也没有反应
-
DNS 问题?你连接到互联网了吗?
标签: .net email iis smtp windows-server-2008