4

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

5

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.

2
  • 7
    As of today it says only port 25 is blocked. Apr 17 '19 at 22:04
  • This baffles me. I would have thought that blocking port 25 traffic would break all email in the world since that is the default port for all server to server SMTP email traffic. Do Mailgun and SendGrid do something special to get around the restriction?
    – Phil
    Sep 2 '19 at 16:30
0

Update to @XanderSmeets answer:

Due to the risk of abuse, connections to destination TCP Port 25 are always blocked when the destination is external to your VPC network. This includes using SMTP relay with Google Workspace.

Google Cloud does not place any restrictions on traffic sent to external destination IP addresses using destination TCP ports 587 or 465. The implied allow egress firewall rule allows this traffic unless you've created egress deny firewall rules that block it.

Source:

https://cloud.google.com/compute/docs/tutorials/sending-mail/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.