簡體   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