Cannot send email through Hotmail / live.com / outlook.com

不打扰是莪最后的温柔 提交于 2019-12-04 13:48:05

I ran into an issue where I was unable to send emails using the smtp.live.com SMTP server from certain hosts -- particulary Azure hosts. In my case, the SMTP attempt was from a host that I had never used to sign-in previously, so the attempt was blocked with the 5.7.3 error:

Mailbox unavailable. The server response was: 5.7.3 requested action aborted; user not authenticated

The solution was to browse to the account settings, locate the SMTP request in its recent activity, and select "This was me":

Tested and it works (different host address and a few other property set):

        using (var client = new SmtpClient("smtp-mail.outlook.com")
        {
            Port = 587,
            DeliveryMethod = SmtpDeliveryMethod.Network,
            UseDefaultCredentials = false,
            EnableSsl = true,
            Credentials = new NetworkCredential(_sender, _password)
        })
        {
            using (var mail = new MailMessage(_sender, _recipient)
            {
                Subject = _subject,
                Body = _message
            })
            {
                client.Send(mail);
            }
        }

Also, if the account has two-step verification turned on, you'll have to generate an app password and use that instead.

Your code works for me without any changes with a live.com address. I am able to generate the same exception by simply putting an incorrect password.

I would suggest following checks:

  1. Did the user change password recently? Are you able to login with the credentials provided over the web interface?
  2. if yes, does your program uses the exact same credentials? please note that white space can be your enemy.
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!