3

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

I'm trying to send email through live.com, but unable to it.

The 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

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

Are you able to send the email by using above code?
It works before, last year, but it is no more working now.
I'm not sure what has been changed to live.com email server.
What new settings or parameters should apply?

mjb
  • 7,649
  • 8
  • 44
  • 60
  • Did you set usedefaultcredentials to false? – box86rowh Aug 10 '14 at 02:14
  • @box86rowh same error still exists. Are you able to use the code to send the email? Or this only happens to me? – mjb Aug 10 '14 at 02:57
  • For one thing, please put your `MailMessage` and `SmtpClient` into `using` blocks: `using (MailMessage mail = new MailMessage()){... using (SmtpClient smtp = new SmtpClient("smtp.live.com", 587)){...}}` – John Saunders Aug 10 '14 at 03:39
  • your code still works for me without any change. Are you using the correct credentials? – Jose Cherian Aug 10 '14 at 05:25
  • 1
    Possible duplicate of [smtp.live.com - mailbox unavailable. The server response was: 5.7.3 requested action aborted; user not authenticated](http://stackoverflow.com/questions/25216202/smtp-live-com-mailbox-unavailable-the-server-response-was-5-7-3-requested-ac) – Mike Cluck Feb 02 '16 at 21:09

4 Answers4

6

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":

Verify the SMTP attempt

slypete
  • 5,538
  • 11
  • 47
  • 64
  • This can be found nowadays here: https://account.microsoft.com/ -> Security -> Review Recent activity – wp78de Dec 06 '17 at 05:17
2

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);
            }
        }
Peter Kiss
  • 9,309
  • 2
  • 23
  • 38
1

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

dobestar
  • 311
  • 3
  • 15
0

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.
Jose Cherian
  • 7,207
  • 3
  • 36
  • 39