关于iis:如何在专用服务器中使用IIS6 SMTP从ASP.NET发送邮件?

关于iis:如何在专用服务器中使用IIS6 SMTP从ASP.NET发送邮件?

How to send mail from ASP.NET with IIS6 SMTP in a dedicated server?

我正在尝试配置一个运行ASP.NET的专用服务器,以通过本地IIS SMTP服务器发送邮件,但是邮件被卡在Queue文件夹中并且无法传递。

我在.aspx页面中使用以下代码进行测试:

1
2
3
4
<%@ Page Language="C#" AutoEventWireup="true" %>

<% new System.Net.Mail.SmtpClient("localhost").Send("info@thedomain.com",
   "jcarrascal@gmail.com","testing...","Hello, world.com"); %>

然后,我将以下内容添加到Web.config文件中:

1
2
3
4
5
6
7
<system.net>
  <mailSettings>
    <smtp>
      <network host="localhost"/>
    </smtp>
  </mailSettings>
</system.net>

在IIS管理器中,我更改了"默认SMTP虚拟服务器"的属性中的以下内容。

1
2
3
4
General: [X] Enable Logging
Access / Authentication: [X] Windows Integrated Authentication
Access / Relay Restrictions: (o) Only the list below, Granted 127.0.0.1
Delivery / Advanced: Fully qualified domain name = thedomain.com

最后,我运行SMTPDiag.exe工具,如下所示:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
C:\\>smtpdiag.exe info@thedomain.com jcarrascal@gmail.com

Searching for Exchange external DNS settings.
Computer name is THEDOMAIN.
Failed to connect to the domain controller. Error: 8007054b

Checking SOA for gmail.com.
Checking external DNS servers.
Checking internal DNS servers.
SOA serial number match: Passed.

Checking local domain records.
Checking MX records using TCP: thedomain.com.
Checking MX records using UDP: thedomain.com.
Both TCP and UDP queries succeeded. Local DNS test passed.

Checking remote domain records.
Checking MX records using TCP: gmail.com.
Checking MX records using UDP: gmail.com.
Both TCP and UDP queries succeeded. Remote DNS test passed.

Checking MX servers listed for jcarrascal@gmail.com.
Connecting to gmail-smtp-in.l.google.com [209.85.199.27] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to gmail-smtp-in.l.google.com.
Connecting to gmail-smtp-in.l.google.com [209.85.199.114] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to gmail-smtp-in.l.google.com.
Connecting to alt2.gmail-smtp-in.l.google.com [209.85.135.27] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to alt2.gmail-smtp-in.l.google.com.
Connecting to alt2.gmail-smtp-in.l.google.com [209.85.135.114] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to alt2.gmail-smtp-in.l.google.com.
Connecting to alt1.gmail-smtp-in.l.google.com [209.85.133.27] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to alt1.gmail-smtp-in.l.google.com.
Connecting to alt2.gmail-smtp-in.l.google.com [74.125.79.27] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to alt2.gmail-smtp-in.l.google.com.
Connecting to alt2.gmail-smtp-in.l.google.com [74.125.79.114] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to alt2.gmail-smtp-in.l.google.com.
Connecting to alt1.gmail-smtp-in.l.google.com [209.85.133.114] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to alt1.gmail-smtp-in.l.google.com.
Connecting to gsmtp183.google.com [64.233.183.27] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to gsmtp183.google.com.
Connecting to gsmtp147.google.com [209.85.147.27] on port 25.
Connecting to the server failed. Error: 10051
Failed to submit mail to gsmtp147.google.com.

我正在使用ASP.NET 2.0,Windows 2003 Server及其随附的IIS。

您能告诉我要解决的其他问题吗?

谢谢

@mattlant

这是一台专用服务器,这就是为什么我要手动安装SMTP的原因。

EDIT: I use exchange so its a little
different, but its called a smart host
in exchange, but in plain SMTP service
config i think its called something
else. Cant remember exactly the
setting name.

感谢您将我指向"智能主机"字段。现在邮件已送达。

在"默认SMTP虚拟服务器"属性的"传递"选项卡中,单击"高级",然后用提供商提供的地址填充"智能主机"字段。以我的情况(GoDaddy)为k2smtpout.secureserver.net。

此处提供更多信息:http://help.godaddy.com/article/1283


我发现通常最好的方法是根据您的ISP的SMTP服务器转发邮件,具体取决于邮件的数量。 少头痛。 从SMTP到外部服务器,而不是asp.net到SMTP,这似乎是您遇到问题的地方。

只需将SMTP服务器设置为将其发送到ISP,或者您可以配置asp.net来发送给它。

编辑:我使用交换,所以有一点不同,但是它被称为交换中的智能主机,但是在简单的SMTP服务配置中,我认为它被称为其他东西。

我不记得确切的设置名称。


两个非常明显的问题(以防万一它们未被覆盖)
1.是否已禁用Windows防火墙?
2.您是否有个人/公司防火墙阻止您的邮件发送?


从外观上看,您的防火墙不会使SMTP(TCP端口25)出入网络。


推荐阅读

    纯命令行linux服务器?

    纯命令行linux服务器?,密码,服务,系统,命令,终端,地址,百度,情况,状态,公共,

    重启服务linux命令?

    重启服务linux命令?,网络,系统,服务,设备,工作,标准,名称,工具,命令,管理,Lin

    linux内核配置命令?

    linux内核配置命令?,工作,系统,管理,环境,信息,命令,工具,软件,设备,服务,调

    linux进入配置的命令?

    linux进入配置的命令?,网络,地址,服务,系统,状态,工作,信息,技术指标,最新,

    linux下命令访问服务?

    linux下命令访问服务?,服务,密码,状态,信息,地址,网络,认证,系统,号码,名称,l

    linux配置网络命令?

    linux配置网络命令?,系统,地址,工作,网络,代码,信息,工具,名字,设备,命令,lin

    检查linux服务器命令?

    检查linux服务器命令?,系统,信息,状态,情况,时间,工具,网络,环境,服务,电脑,

    linux7关闭服务命令?

    linux7关闭服务命令?,系统,软件,服务,命令,电脑,状态,工具,管理,进程,用户,求

    linux服务器域名命令?

    linux服务器域名命令?,地址,信息,系统,网络,服务,环境,名称,网站,管理,电脑,l

    服务启动linux命令?

    服务启动linux命令?,服务,密码,信息,系统,名称,命令,文件,用户,下面,服务器,l

    linux服务器命令框?

    linux服务器命令框?,系统,情况,状态,信息,数据,软件,指标,服务,在线,工具,lin

    配置linux命令行颜色?

    配置linux命令行颜色?,系统,地址,电脑,分析,代码,信息,设备,终端,颜色,命令,L

    linux配置相关的命令?

    linux配置相关的命令?,网络,地址,系统,工具,代码,状态,命令,信息,管理,初级,

    linux配置网卡的命令?

    linux配置网卡的命令?,网络,信息,系统,工具,代码,地址,设备,工作,电脑,最新,i

    服务器linux命令教程?

    服务器linux命令教程?,系统,地址,密码,网络,设备,工作,服务,标准,连续,管理,

    linux删除服务的命令?

    linux删除服务的命令?,服务,系统,软件,平台,名称,管理,环境,产品,命令,文件,

    linux开机服务命令行?

    linux开机服务命令行?,系统,工作,地址,信息,服务,设备,数字,第一,设计,发行,l

    linux服务器分区命令?

    linux服务器分区命令?,系统,管理,信息,设备,时间,命令,基础,首次,平均,情况,l

    配置网关的命令linux?

    配置网关的命令linux?,地址,系统,网络,代码,信息,环境,命令,网关,服务,电脑,

    linux下看服务的命令?

    linux下看服务的命令?,服务,状态,系统,名称,信息,工具,命令,环境,网络,情况,