If you have installed postfix in your Ubuntu server from digital ocean and trying to configure Sendgrid SMTP then here are the instructions – Sendgrip SMTP with postfix
Looks like ports 25, 587 and 465 are blocked by Digital ocean. So make sure to use port 2525. I wasted a whole day trying to figure out what’s wrong. But turns out that 2525 is the only port supported by Sendgrid and allowed by Digital Ocean.
I was actually using PhpMailer and trying to configure SMTP with that but It did not work So I installed postfix to investigate the issue from scratch and found that all I had to do was change the port to 2525.
So If you had an issue configuring Sendgrid SMTP with a Digital Ocean server then use port 2525 and It should work!