Can't send email via Hotmail / live.com / outlook.com

I have read other answers on stackoverflow. but none of the solutions work for me.

I am trying to send email via live.com but cannot.

Error message:

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

      

or error message:

System.Net.Mail.SmtpException: Service not available, 
closing transmission channel. 
The server response was: Cannot connect to SMTP server 65.55.176.126 
(65.55.176.126:587), NB connect error 1460

      

Code:

MailMessage mail = new MailMessage();
mail.From = new MailAddress("email@live.com");
mail.To.Add("someone@someone.com");
mail.Subject = "hello";
mail.Body = "awefkljj kawefl";
mail.IsBodyHtml = false;

SmtpClient smtp = new SmtpClient("smtp.live.com", 587);
smtp.EnableSsl = true;
smtp.Credentials = new NetworkCredential("email@live.com", "password");
smtp.Send(mail);

      

Can you send an email using the above code?
He works before, last year, but now he is no longer working.
I'm not sure what changed to live.com email server.
What new parameters or parameters should be applied?

+3


source to share


4 answers


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

The mailbox is not available. Server response: 5.7.3 requested action aborted; user is not authenticated



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

Verify the SMTP attempt

+5


source


Tested and working (different host address and a few other properties):



        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);
            }
        }

      

+1


source


Also, if the account has 2-Step Verification, you will have to generate an app password and use it.

+1


source


Your code works for me without any change from live.com address. I can throw the same exception just by putting in the wrong password.

I would suggest the following checks:

  • Has a user recently changed their password? Can you log in with the credentials provided through the web interface?
  • if so, is your program using the correct credentials? note that the space bar can be your enemy.
0


source







All Articles