How to receive email on Google Compute Engine
Asked Answered
G

2

8

Google's compute engine blocks all outgoing email ports by default. Quote from Compute Engine Documentation

Compute Engine blocks or restricts traffic through all of the following ports/protocols between the Internet and virtual machines, and between two virtual machines when traffic is addressed to their external IP addresses through these ports (this also includes load-balanced addresses): > All outgoing traffic to port 25 (SMTP) is blocked. Most outgoing traffic to port 465 or 587 (SMTP over SSL) is blocked, except for known Google IP addresses.

As a solution to this, Google advices the use of third-party sites like SendGrid to manage email. SendGrid can easily help you send email, but receiving emails is not so easy.

Installing an email client on the server won't help because the ports through which these clients need to communicate with other servers to receive emails remain blocked.

My question is what's the easiest solution to receiving email? SendGrid's solution is for sending emails, and the Compute Engine Documentation specifies this. I've installed postfix but all emails to my server receive timeout errors, and my inbox remains empty.

Galle answered 25/6, 2017 at 18:11 Comment(1)
In case you are running on App Engine, can also use Google's Mail API: cloud.google.com/appengine/docs/standard/php/mail/…Plater
G
8

TL;DR - You're right outgoing email ports are blocked, but incoming email ports are not. If you open them, and run a mail server which listens for incoming emails - you can still receive them. You will need to use 3rd party email sender gateways like SendGrid only to send the emails.

Longer version

All outgoing traffic to port 25/465/587 are blocked so that people do not abuse GCE for sending out spam, phishing, etc. emails.

You can still run a mail server which just receives emails. In other words, there is no mention that incoming traffic to those ports are blocked. By default GCE firewall blocks all incoming traffic. You will have to open up these listening ports using firewall rules.

Gisborne answered 25/6, 2017 at 18:39 Comment(1)
i have opened the necessary ports, i can telnet my server on 993 and 143 but i still cannot receive emails from external domains. please helpAnhanhalt
H
1

I'm using Mailgun instead of SendGrid. I forward all the emails to one of my gmail accounts using MailGun's forwarding rules. SendGrid too should have forwarding rules.

Hydroponics answered 25/6, 2017 at 18:23 Comment(1)
Just gone through Google and sendGrid's documentations and SendGrid doesn't seem to have forwarding rules. I might have to go with MailGun if no such rules really exist...Galle

© 2022 - 2024 — McMap. All rights reserved.