Mailbox unavailable. The server response was: 5.7.3 Requested action aborted; user not authenticated
public async static Task SendEmailAsync(string email, string subject, string message) { try { var _email = "erjoshi@outlook.com"; var _epass = ConfigurationManager.AppSettings["Emailpassword"]; var _dispName = "HimanshuJoshi"; MailMessage myMessage = new MailMessage(); myMessage.To.Add(email); myMessage.From = new MailAddress(_email, _dispName); myMessage.Subject = subject; myMessage.Body = message; myMessage.IsBodyHtml = true; using (SmtpClient smtp = new SmtpClient()) { smtp.EnableSsl = true; smtp.Host = "smtp.live.com"; smtp.Port = 587; smtp.UseDefaultCredentials = false; smtp.Credentials = new NetworkCredential(_email, _epass); smtp.DeliveryMethod = SmtpDeliveryMethod.Network; smtp.SendCompleted += (s, e) => { smtp.Dispose(); }; await smtp.SendMailAsync(myMessage); } } catch (Exception ex) { throw ex; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)