SendGrid Error "The server committed a protocol violation" specific to Azure configuration

0

Azure to SendGrid was working fine then one day stopped working. The error when sending smtp mail (not using the API) is "The server committed a protocol violation."

  • Tried every combination of ports and SSL vs. Non-SSL config to no avail
  • Using the same SendGrid account outside of azure works fine
  • Disabled IP whitelists and tried adding azure IPs to whitelist to no avail
  • Tried resetting password from within the Azure account, which still didn't work

madamission

Posted 2017-03-06T20:15:03.063

Reputation: 561

Answers

1

After trying many techniques, what finally ended up fixing it was by deleting the account in azure and creating a new one. Posting this here because we couldn't find this simple answer anywhere.

Some things to point out:

  • It seems that Azure is picky about SendGrid having to be provisioned inside of Azure, and doesn't work well with SendGrid accounts that were provisioned inside of SendGrid.
  • The previous account was originally provisioned inside of Azure, and was originally working, but that stopped working for some reason. The only thing we did differently was modify the subusers by adding a new "team member" which may have somehow invalidated the special azure user. Or it's possible there could have been some other issue outside our control.
  • The previous account that stopped working was not showing up under All Resources in Azure, but was showing up in sendgrid accounts. The new account showed up in both.

UPDATE 11-28-2018: I've also notice this issue happen when the sendgrid account monthly limit is exceeded. It's not for the use case described above, but important to note that it might also be the reason for this error message.

madamission

Posted 2017-03-06T20:15:03.063

Reputation: 561

1I managed to get it working by following the steps you outlined but I used an API key as my SMTP password and 'apikey' as the SMTP username. I have not yet been able to get TLS/SSL working, so the mail is being sent over port 25 - but I think this is more an issue with my app (Kentico CMS) than azure or sendgrid.

Using an existing sendgrid account did not work at all - I had to create a new one through the azure portal. – seangwright – 2017-05-05T22:34:21.887