我们正在致力于使用System.Net.Mail.SmtpException发送电子邮件的项目。
SmtpClient client = new SmtpClient("127.0.0.1");
if (ConfigSetting.Is2008 || ConfigSetting.IsLocal)
client.DeliveryMethod = SmtpDeliveryMethod.Network;
else
client.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
client.Send(message);Client.Send(消息)抛出这两个异常:
1.如果发送到本地服务器,则获得异常:
System.Net.Mail.SmtpException:发送邮件失败。-> System.Net.WebException:无法连接到远程服务器
2.使用我们的配置发送电子邮件,然后面对这个异常:
System.Net.Mail.SmtpException:无法获取IIS拾取目录。在System.Net.Mail.IisPickupDirectory.GetPickupDirectory() at System.Net.Mail.SmtpClient.Send(MailMessage message)
我已经在SMTP电子邮件中设置了IIS管理器:存储电子邮件,位于拾取目录中。
或手动添加:
client.PickupDirectoryLocation = "C:\\Users\\Admin\\Desktop\\EmailLocation";但是没有解决任何错误:System.Net.Mail.SmtpException:无法获得IIS拾取目录.
我的工作是:
发布于 2015-12-23 16:54:54
更改为System.Net.Mail.SmtpDeliveryMethod.SpecifiedPickupDirectory
https://stackoverflow.com/questions/30376378
复制相似问题