问题描述
我一直在使用 Smtp 服务器 127.0.0.1 .我得到的错误:
I’ve been using the Smtp server 127.0.0.1 .The error I get:
System.Net.Mail.SmtpException: 无法在 System.Net.Mail.IisPickupDirectory.GetPickupDirectory() 获取 IIS 分拣目录.
此错误发生在从 ASP 网页发送电子邮件时.但从 ASP.NET 页面发送电子邮件时,没有发生错误.请帮忙.
This Error occured ,when Email send from ASP web page.But EMail send from ASP.NET page,error is not occurred. Plz help .
推荐答案
不幸的是,当尝试确定 IIS/SMTP 拾取目录的位置时出现任何类问题时,会引发此异常.一个常见的原因是缺少 IIS SMTP 服务.
Unfortunately, this exception is raised when any kind of problem occurs while trying to determine the location of IIS/SMTP pickup directory. A common cause is missing IIS SMTP service.
如果您使用 System.Net.Mail.SmtpClient 发送邮件,请尝试手动设置取件目录:
If you are sending mail using System.Net.Mail.SmtpClient, try setting the pickup directory manually:
// C#
var client = new SmtpClient();
client.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
client.PickupDirectoryLocation = ...;
client.Send(...);
或者改为在 ASP.NET 的 Web.config 中设置:
Or set this in ASP.NET's Web.config instead:
<configuration>
<system.net>
<mailSettings>
<smtp deliveryMethod="SpecifiedPickupDirectory">
<specifiedPickupDirectory
pickupDirectoryLocation="..." />
<network defaultCredentials="false" />
</smtp>
</mailSettings>
</system.net>
</configuration>
或者,使用 SmtpDeliveryMethod.Network
方法并将 Host
和 Port
属性发送到您的 SMTP 服务器.
Alternatively, use SmtpDeliveryMethod.Network
method instead and sent the Host
and Port
properties to your SMTP server.
更多信息:http://forums.iis.net/p/1149338/1869548.aspx
这篇关于无法获取 IIS 拾取目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!