[研究]寄信失敗。伺服器回應為: User not local. Authentication required for relay
2024-03-25
環境:Visual Studio 2022 + ASP.NET + WebForm + Web Application + C# + SQL Server 2019 + SQL Server Management Studio (SSMS) 19
********************************************************************************
System.Net.Mail.SmtpException: 異動失敗。 伺服器回應為: User not local. Authentication required for relay
System.Web.HttpUnhandledException (0x80004005): 已發生類型 'System.Web.HttpUnhandledException' 的例外狀況。 ---> System.Net.Mail.SmtpException: 異動失敗。 伺服器回應為: User not local. Authentication required for relay
於 System.Net.Mail.RecipientCommand.CheckResponse(SmtpStatusCode statusCode, String response)
於 System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, Boolean allowUnicode, SmtpFailedRecipientException& exception)
於 System.Net.Mail.SmtpClient.Send(MailMessage message)
於 Admin_ForgetPwd.btn_SentOut_Click(Object sender, EventArgs e) 於 D:\Code\Solution1\WebApplication1\WebForm1.aspx.cs: 行 322
於 System.Web.UI.WebControls.Button.OnClick(EventArgs e)
於 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
於 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
於 System.Web.UI.Page.HandleError(Exception e)
於 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
於 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
於 System.Web.UI.Page.ProcessRequest()
於 System.Web.UI.Page.ProcessRequest(HttpContext context)
於 System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
於 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
於 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
********************************************************************************
【Mail Server上】
Microsoft Windows [版本 10.0.14393]
(c) 2016 Microsoft Corporation. 著作權所有,並保留一切權利。
C:\Users\Administrator>netstat -an
使用中連線
協定 本機位址 外部位址 狀態
TCP 0.0.0.0:22 0.0.0.0:0 LISTENING
TCP 0.0.0.0:25 0.0.0.0:0 LISTENING
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING
TCP 0.0.0.0:110 0.0.0.0:0 LISTENING
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING
TCP 0.0.0.0:999 0.0.0.0:0 LISTENING
|
(下圖)Mail Server 的 Allow Relay 有勾選
********************************************************************************
【Web Server上】
telnet xxx.xxx.xxx.xxx 25 測試正常連上
********************************************************************************
【Mail Server Log】(IP 和 email 資訊我遮蔽換掉了)
2024/3/25 下午 04:12:14 - SMTP Server started. Listening on port 25 2024/3/25 下午 04:12:14 - POP3 Server started. Listening on port 110 2024/3/25 下午 04:12:14 - Finger Server started. Listening on port 79 2024/3/25 下午 04:12:14 - Web Server started. Listening on port 999 Message size limit 5 MB Winsock version: $0101 High version: $0202 Description: WinSock 2.0 System status: Running Maximum sockets: 32767 Local host: ArGoSoftMail Local addresses: yyy.yyy.yyy.yyy Local host after reverse lookup: ArGoSoftMail 2024/3/25 下午 04:12:42 - Requested SMTP connection from xxx.xxx.xxx.xxx 2024/3/25 下午 04:12:42 - ( 20770) 220 ArGoSoft Mail Server Freeware, Version 1.8 (1.8.8.8) 2024/3/25 下午 04:12:43 - ( 20770) EHLO ISG-WEB-TEST 2024/3/25 下午 04:12:43 - ( 20770) 250-Welcome [xxx.xxx.xxx.xxx], pleased to meet you 2024/3/25 下午 04:12:43 - ( 20770) 250-AUTH=LOGIN 2024/3/25 下午 04:12:43 - ( 20770) 250-AUTH LOGIN 2024/3/25 下午 04:12:43 - ( 20770) 250-SIZE 5242880 2024/3/25 下午 04:12:43 - ( 20770) 250 HELP 2024/3/25 下午 04:12:43 - ( 20770) MAIL FROM:<SysA@mytest.idv> 2024/3/25 下午 04:12:43 - ( 20770) 250 Sender "SysA@mytest.idv" OK... 2024/3/25 下午 04:12:44 - ( 20770) RCPT TO:<user1@nccst.nat.gov.tw> 2024/3/25 下午 04:12:44 - ( 20770) 554 User not local. Authentication required for relay 2024/3/25 下午 04:12:44 - ( 20770) 2024/3/25 下午 04:12:44 - Error: [10054] Connection reset by peer 2024/3/25 下午 04:12:44 - SMTP connection with xxx.xxx.xxx.xxx ended. ID=20770 2024/3/25 下午 04:12:44 - Requested SMTP connection from xxx.xxx.xxx.xxx 2024/3/25 下午 04:12:44 - ( 20771) 220 ArGoSoft Mail Server Freeware, Version 1.8 (1.8.8.8) 2024/3/25 下午 04:12:44 - ( 20771) EHLO ISG-WEB-TEST 2024/3/25 下午 04:12:44 - ( 20771) 250-Welcome [xxx.xxx.xxx.xxx], pleased to meet you 2024/3/25 下午 04:12:44 - ( 20771) 250-AUTH=LOGIN 2024/3/25 下午 04:12:44 - ( 20771) 250-AUTH LOGIN 2024/3/25 下午 04:12:44 - ( 20771) 250-SIZE 5242880 2024/3/25 下午 04:12:44 - ( 20771) 250 HELP 2024/3/25 下午 04:12:45 - ( 20771) AUTH login c2U= 2024/3/25 下午 04:12:45 - ( 20771) 334 UGFzc3dvcmQ6 2024/3/25 下午 04:12:45 - ( 20771) MTIzNDU2 2024/3/25 下午 04:12:45 - ( 20771) 235 Authentication successful 2024/3/25 下午 04:12:45 - ( 20771) MAIL FROM:<SysA@mytest.idv> 2024/3/25 下午 04:12:45 - ( 20771) 250 Sender "SysA@mytest.idv" OK... 2024/3/25 下午 04:12:46 - ( 20771) RCPT TO:<user2@mytest.idv> 2024/3/25 下午 04:12:46 - ( 20771) 250 Recipient "user2@mytest.idv" OK... 2024/3/25 下午 04:12:46 - ( 20771) RCPT TO:<user1@mytest.idv> 2024/3/25 下午 04:12:46 - ( 20771) 250 Recipient "user1@mytest.idv" OK... 2024/3/25 下午 04:12:47 - ( 20771) DATA 2024/3/25 下午 04:12:47 - ( 20771) 354 Enter mail, end with "." on a line by itself 2024/3/25 下午 04:12:47 - Received 20306 bytes 2024/3/25 下午 04:12:47 - ( 20771) 250 Message accepted for delivery. <3q3mhsjzmgrszu7.250320241612@ArGoSoftMail> 2024/3/25 下午 04:12:48 - [ 20772] Delivering to 2 recipients 2024/3/25 下午 04:12:48 - [ 20772] Attempting to deliver to the domain mytest.idv 2024/3/25 下午 04:12:48 - [ 20772] Retrieved 5 MX records for domain mytest.idv 2024/3/25 下午 04:12:48 - [ 20772] Trying the server ms1.mytest.idv: zzz.zzz.zzz.zzz 2024/3/25 下午 04:12:49 - [ 20772] 220 ms1.mytest.idv ESMTP 2024/3/25 下午 04:12:49 - [ 20772] EHLO ArGoSoftMail 2024/3/25 下午 04:12:50 - [ 20772] 250-ms1.mytest.idv 2024/3/25 下午 04:12:50 - [ 20772] 250-8BITMIME 2024/3/25 下午 04:12:50 - [ 20772] 250-SIZE 104857600 2024/3/25 下午 04:12:50 - [ 20772] 250 STARTTLS 2024/3/25 下午 04:12:50 - [ 20772] MAIL FROM:<SysA@mytest.idv> 2024/3/25 下午 04:12:52 - [ 20772] 250 sender <SysA@mytest.idv> ok 2024/3/25 下午 04:12:52 - [ 20772] RCPT TO:<user2@mytest.idv> 2024/3/25 下午 04:12:52 - [ 20772] 250 recipient <user2@mytest.idv> ok 2024/3/25 下午 04:12:52 - [ 20772] RCPT TO:<user1@mytest.idv> 2024/3/25 下午 04:12:53 - [ 20772] 250 recipient <user1@mytest.idv> ok 2024/3/25 下午 04:12:53 - [ 20772] DATA 2024/3/25 下午 04:12:53 - [ 20772] 354 go ahead 2024/3/25 下午 04:12:53 - [ 20772] 2024/3/25 下午 04:12:53 - [ 20772] . 2024/3/25 下午 04:12:54 - [ 20772] 250 ok: Message 5150489 accepted 2024/3/25 下午 04:12:54 - [ 20772] QUIT 2024/3/25 下午 04:12:55 - [ 20772] 221 ms1.mytest.idv 2024/3/25 下午 04:12:55 - [ 20772] Message from SysA@mytest.idv relayed to 2 recipient(s) on the domain mytest.idv |
********************************************************************************
【解決】
最後把 Mail client 的 IP 加入 Mail Server 的 SMTP Authentication 中,暫時先這樣。(完)
相關
沒有留言:
張貼留言