繁体   English   中英

SMTP代码在本地Windows中发送电子邮件,但不在Windows Server 2012中发送电子邮件

[英]SMTP Code Is Sending Email In Local Windows But Not In Windows Server 2012

我已经在Windows Server 2012中设置了SMTP服务器。

我确保它正在运行。

将txt文件放入mailroot提取文件夹中将发送电子邮件。

该代码正在本地Windows 7计算机中发送电子邮件。

我还在IIS 7中设置了SMTP。

 MailMessage mail = new MailMessage("saimanti.das@lahey.org", "saimanti.das@lahey.org");
 SmtpClient client = new SmtpClient();
 client.Port = 25;
 client.DeliveryMethod = SmtpDeliveryMethod.Network;
 client.UseDefaultCredentials = false;
 client.Host = "relaysmtp.lahey.org";
 mail.Subject = "this is a test email.";
 mail.Body = "this is my test email body";
 client.Send(mail);

这确实不是SMTP的问题。 SMTP正在工作。 我的代码中有一个错误,我没有捕获IIS 8.0实例。

谢谢您的帮助,这个网站真的很好。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM