【发布时间】:2012-02-08 21:25:08
【问题描述】:
我对配置 asp.net 网站以发送电子邮件完全感到困惑 - 希望你能在这里帮助我
它在带有 IIS 7.5 的 Win 2008 R2 上运行 我有 VS 2010 asp.net 应用程序试图发送电子邮件。
[1] 我在此服务器中安装了 STMP 服务器 - 但无法在功能视图中找到“发送电子邮件”。这是一个问题吗?
[2] 这是我的代码
using System.Net.Mail;
:
:
//(1) Create the MailMessage instance
MailMessage mm = new MailMessage("test@mycompany.com", "test222@mycompany.com");
//(2) Assign the MailMessage's properties
mm.Subject = "Subject";
mm.Body = "the content of body here";
mm.IsBodyHtml = true;
//(3) Create the SmtpClient object
SmtpClient smtp = new SmtpClient();
//(4) Send the MailMessage (this will use the Web.config settings)
smtp.Send(mm);
web.config 文件有
<system.net>
<mailSettings>
<smtp deliveryMethod="Network">
<network
host="MailServer2"
port="25"
userName="user_id"
password="password"
/>
</smtp>
</mailSettings>
</system.net>
在我的公司,我们有一个邮件服务器(MS Exchnage 服务器)托管在不同的服务器(比如 MailServer2)上
所以
如果我使用“host=”作为 MailServer2(这是邮件服务器) - 它说,“无法建立连接,因为目标机器主动拒绝”
如果我使用“host=”作为本地主机 IP - 错误是 “邮箱不可用。服务器响应为:5.7.1 无法中继“
即使我尝试使用 Start-->Admin tool->IIS 6.0 Manager 选项配置 SMTP,但没有任何乐趣。
我在做傻事吗? iis7 对我来说非常新 - 任何帮助都非常有用。
有什么帮助吗?
干杯 金星
【问题讨论】:
-
什么版本的 Exchange Server?
-
我尝试使用此处指定的方法 [link]office.microsoft.com/en-us/outlook-help/… 找到它,它显示为 32981。但与我的管理员交谈,他说它是 2007。这个配置是否取决于 Exchange 版本?