我已經看了其他線程,迄今沒有找到解決辦法。 每當我嘗試通過下面的方法進行連接時,都會收到net_io_connectionclosed錯誤。net_io_connectionclosed錯誤試圖通過office365發送在c#
我正在嘗試使用Office 365 smtp中繼。我無權訪問主帳戶或無法更改此電子郵件的任何內容,因此我無法檢查設置或重置密碼。
任何和所有幫助感激地收到。
UNAME:中繼賬戶的電子郵件地址(無回覆@ [X] .COM)
我在等待我的電子郵件,以獲得onmicrosoft.com地址的回覆,但它是根本沒有在任何教程中提及。因此,這裏的uname也在msg中作爲'from'地址。
pwd:password。
SmtpClient client = new SmtpClient("smtp.office365.com", 587);
client.UseDefaultCredentials = false;
client.EnableSsl = true;
client.Credentials = new System.Net.NetworkCredential(uname, pwd);
client.TargetName = "STARTTLS/smtp.office365.com";
client.Timeout = 10000;
client.Send(msg);