[C#] Outlook 使用 SMTP 寄信出現 異動失敗。 伺服器回應為: 5.2.0 STOREDRV.Submission.Exception:OutboundSpamException; Failed to process message due to a permanent exception with message WASCL UserAction verdict is not None.
最近在用 outlook 的信件寄送一些信件,但是出現了一些問題這畫面,分享一下,今天我從開戶到可以寄信的過程..
錯誤訊息:
異動失敗。 伺服器回應為: 5.2.0 STOREDRV.Submission.Exception:OutboundSpamException; Failed to process message due to a permanent exception with message WASCL UserAction verdict is not None. Actual verdict is RefuseQuota, ShowTierUpgrade. OutboundSpamException: WASCL UserAction verdict is not None. Actual verdict is RefuseQuota, ShowTierUpgrade. [Hostname=HK2PR03MB4532.apcprd03.prod.outlook.com]
描述: 在執行目前 Web 要求的過程中發生未處理的例外狀況。請檢閱堆疊追蹤以取得錯誤的詳細資訊,以及在程式碼中產生的位置。
例外狀況詳細資訊: System.Net.Mail.SmtpException: 異動失敗。 伺服器回應為: 5.2.0 STOREDRV.Submission.Exception:OutboundSpamException; Failed to process message due to a permanent exception with message WASCL UserAction verdict is not None. Actual verdict is RefuseQuota, ShowTierUpgrade. OutboundSpamException: WASCL UserAction verdict is not None. Actual verdict is RefuseQuota, ShowTierUpgrade. [Hostname=HK2PR03MB4532.apcprd03.prod.outlook.com]
1. 到 https://outlook.com 開戶,然後通過電話驗證 。(如果你不想通過電話驗證,建議作法大概就是開戶後使用一段時間再試試看,我有的帳戶沒有過電話驗證也能用)
2. 去設定 => 郵件 => 允許設備應用使用 POP 打開,下面就會拿到 SMTP 資訊
3. 開始寫 code ,方法很多不一定要跟我的一樣,我只是附上,我這邊測試可以用的
MailMessage msg = new MailMessage(); | |
msg.From = new MailAddress("your@hotmail.com", fromName); | |
msg.To.Add(toMail); | |
msg.Subject = subject; | |
msg.Body = body; | |
msg.IsBodyHtml = true; | |
msg.ReplyToList.Add(new MailAddress(replyTo, "ReplyFromUser")); | |
using (SmtpClient smtp = new SmtpClient("smtp.office365.com", 587)) | |
{ | |
smtp.UseDefaultCredentials = false; | |
smtp.Credentials = new NetworkCredential("your@hotmail.com", "your_password"); | |
smtp.EnableSsl = true; | |
smtp.Send(msg); | |
} | |
4. 如果沒有收到信,就是回到收件夾,應該會看到他需要你再次驗證你的身分,記得就是再次驗證自己身分,這時候很容易出現要電話驗證(攤手..
5 . 如果你出現 伺服器回應為: 5.2.0 STOREDRV.Submission.Exception:OutboundSpamException; Failed to process message due to a permanent exception with message WASCL UserAction verdict is not None. 問題,很簡單,就是你的 步驟 3 的程式碼 = new MailAddress("your@hotmail.com", fromName); 你的 來源 email 一定要跟你現在寄信的 Email 需要是一致的,因為 Gmail 是沒有阻擋這件事情,但是 Outlook 有,分享一下給大家我遇到的雷..
Happy Coding : )