Recently I was configuring smtp on some applications to send emails on Google compute engine and ran into weird errors, After little research, below is the solution provided by Google
Google Compute Engine does not allow outbound connections on ports 25, 465, and 587 but you can still set up your instances to send mail through ports 587 and 465 using servers provided through partner services, such as SendGrid. This document discusses how to set up your instances to send email using SendGrid.
SendGrid is a partner service that provides Google Compute Engine customers with a free or paid SendGrid account that you can use to send mail from Google Compute Engine instances. SendGrid offers a number of advantages:
- free tier* to Google Compute Engine customers that includes 25,000 transactional email messages per month
- Ability to send emails from addresses other than @gmail.com
- No daily limit on the number of transactional email messages