Send email using Outlook.com SMTP

后端 未结 1 705
-上瘾入骨i
-上瘾入骨i 2020-12-20 21:30

I am trying to send an automated email using Outlook.com smtp support. However I am get the following exception:

System.Net.Mail.SmtpException: Failure sendi         


        
相关标签:
1条回答
  • 2020-12-20 22:29

    I know that this is an extremely old question and I might not even be able to help, however I had a similar problem when I tried to send an email using C#.

    As a result I used this which allowed me to send the emails:

    string _sender = "";
            string _password = "";
    
            SmtpClient client = new SmtpClient("smtp-mail.outlook.com");
    
            client.Port = 587;
            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            client.UseDefaultCredentials = false;
            System.Net.NetworkCredential credentials =
                new System.Net.NetworkCredential(_sender, _password);
            client.EnableSsl = true;
            client.Credentials = credentials;
    
            MailMessage message = new MailMessage(_sender, "recipient of email");
            message.Subject = "";
            message.Body = "";
            client.Send(message);
    

    This probably will be of no use to you anymore, but in case anyone stumbles onto this question at least there is an answer which has working code acting as a fix!

    0 讨论(0)
提交回复
热议问题