How to Setup a Mailserver on Google Cloud VM

email-servergoogle-cloud-platformUbuntu

I want to know how to setup a mail server like postfix on Google VP instance.

I'm running Ubuntu 16.04 (and LAMP stack) and can't get the mail server to send email from website.

I have installed postfix, and opened port 25, but no luck.

Any ideas on how to proceed?

Error logs: Network is unreachable and Connection timed out

Best Answer

According to https://cloud.google.com/compute/docs/tutorials/sending-mail/, you cannot set up a mail server the usual way, as ports 25, 465 and 587 are blocked for outbound connections on Google Cloud. Instead, you might take a look at relaying services such as Mailgun or SendGrid, which allow sending through port 2525 or an API instead. These services might cost a little bit of money, however.