i'm trying to send mail from my asp.net app, on azure, but without success.
Im my local machine im able to do this, with the same code:
MailMessage msg = new MailMessage();
msg.From = new MailAddress("maymail@gmail.com", "myName");
msg.Subject = subject;
msg.Body = body;
msg.BodyEncoding = System.Text.Encoding.GetEncoding("ISO-8859-1");
msg.IsBodyHtml = html;
SmtpClient client = new SmtpClient("smtp.gmail.com");
client.Port = 25; //587 works too
client.Credentials = new NetworkCredential("mymail@gmail.com", "myPass");
client.EnableSsl = true;
client.Send(msg);
Im my environment, it works well.
After deploy in azure environment, i receive the exception:
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.
Anybody knows why?
Thanks a lot!