i'm stuck in this problem when button click it always says "Failure to send email" I try several host like smtp.office365.com, pod51015.outlook.com and ports like 465, 25 and nothing seems to work
string _sender = "myEmail.com";
string _password = "myPass";
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, "toEmail.com");
message.Subject = "mySubject";
message.Body = "myBody";
client.Send(message);
CTTO of this code which I also found in this forum which seem they worked for them.