[英]SMTP Code Is Sending Email In Local Windows But Not In Windows Server 2012
I have set up the SMTP server in Windows Server 2012. 我已经在Windows Server 2012中设置了SMTP服务器。
I have made sure it is running. 我确保它正在运行。
Putting a txt file in mailroot pickup folder is sending email. 将txt文件放入mailroot提取文件夹中将发送电子邮件。
The code is sending email in local Windows 7 computer. 该代码正在本地Windows 7计算机中发送电子邮件。
I also set up SMTP in IIS 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);
This was really not an issue of SMTP. 这确实不是SMTP的问题。 SMTP was working.
SMTP正在工作。 There was a bug in my code where I was not catching the IIS 8.0 instance.
我的代码中有一个错误,我没有捕获IIS 8.0实例。
Thanks fot your help and this site is really good. 谢谢您的帮助,这个网站真的很好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.