We have two Azure apps that run an MVC website in one and a continuous webjob in the other. Both suddenly yesterday around midday started giving the error below when sending emails using smtpclient.
The remote certificate is invalid according to the validation procedure
No changes have been made in the code or in the mail server. We had this issue in February 2017 with no solution then (https://social.msdn.microsoft.com/Forums/en-US/f2f35ab9-3d0a-490f-b639-8ea5abda92d5/intermittent-the-remote-certificate-is-invalid-according-to-the-validation-procedure?forum=windowsazurewebsitespreview) and again the same issue around September 2016.
Same code sends the email fine locally and it also works from one of our VMs.
using (var smtp = new SmtpClient("mail.server.com", 25))
{
smtp.EnableSsl = true;
smtp.Credentials = new NetworkCredential(username, password);
smtp.Send(message);
}
Tried https://twitter.com/AzureSupport but they are not replying. We don't have Azure support plan but why would we have to pay for something we didn't break or wait 8 hours or even an 1 hour for such critical part of any business like sending an email?
We've started rolling most of our web apps to Azure but we've been moving them back to a server since it's one problem after another... Those two Azure apps were the last ones and now only one left and only because it uses webjobs and the code relies on being a webjob.
UPDATE: Both certificates thumbprints in Azure app and mail server match.