I had a bit of a mare after starting work Monday morning and seeing several error messages from my Azure-hosted ASP site like this:

System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at
   at System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response)
   at System.Net.Mail.SmtpTransport.
SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, Boolean allowUnicode, SmtpFailedRecipientException& exception)
   at System.Net.Mail.SmtpClient.Send(MailMessage message)
   at ...

The thing that was annoying was that no updates had been made to the site for probably at least a week and certainly nothing in the email sending code for a couple of months. Of course, being on Azure meant it would not be easy to debug or fix.

Firstly, I tried to change the gmail portto 465 from 587, apparently 587 (which I was using) is strictly for IMAP and 465 for SMTP. It also appears that one is SSL and the other TLS which is confusing since TLS is the replacement for SSL so I don't know whether this is something historical. Anyway, it didn't work.

What I then did was to use Azure role configuration for the various gmail settings since changing the hard-coded values and updating was being too slow. After doing this, it all appeared to start working again but with the original values that were causing the error.

Basically, something was happening/had happened somewhere between Azure and GMail and this had broken my site. Since I use emails for account validation, as many sites do, this was a big deal for me since it means people could not sign up.

The thing I despise the most about the net is that we are still largely unable to work out what happens at network level, what part of the internet is slowing us down, where things are broken etc. How many times do you have to call and complain to your service providers who may or may not be at fault? The Azure site monitoring thing is OK but when I had problems with the mail, the site was locked up but the monitoring said the site was running fine so I don't have a lot of trust.

Anyway, I wrote this so other's might realise that you haven't done anything wrong!