Rob Hughes
Rob Hughes

Reputation: 906

Google cloud engine: Open port 587

In my rails app I have email setup with Amazon SES as I was previously using beanstalk.

I have moved to Google Cloud Engine but I want to keep using Amazon SES as the free tier allows up to 50000 emails per day and my app is already coded to process bounces and complaints with the Amazon service.

Amazon state:

You need to confirm with your host that ports 465 and 587 are open 
for outgoing SMTP calls. It will not be possible to use Amazon SES 
unless these ports are open.

Google state:

Google Compute Engine does not allow outbound connections on ports 
25, 465, and 587

Is there any way at all to open up ports 587 in my Google Cloud App and use Amazon SES email service? This is extremely frustrating. Google have guides for sendgrid and mailgun, both of which are irrelevant for me.

Upvotes: 2

Views: 1309

Answers (3)

Julien AMIC
Julien AMIC

Reputation: 1

Regarding Google restrictions on ports 25, 465, and 587 an easy workaround is to setup a port forwarding rule and use some other ports.

ie :

-A PREROUTING -p tcp -m tcp -i eth0 --dport 15000 -j DNAT --to-destination XXX.XXX.XXX.XXX:587

Upvotes: 0

Michael - sqlbot
Michael - sqlbot

Reputation: 179314

The workaround is in the SES documentation.

To set up a STARTTLS connection, the SMTP client connects to the Amazon SES SMTP endpoint on port 25, 587, or 2587

http://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-connect.html

tl;dr? Use port 2587.

Upvotes: 2

Dan Cornilescu
Dan Cornilescu

Reputation: 39834

I don't think you'll be able to use those ports, especially when, as you observed, it's clearly documented that they're not allowed.

A possible approach is to have a simpler app on Amazon, which would just be acting as a relay, if you want, for the GCE app (which would contain the rest of the functionality) by:

  • listening for email sending instructions from your GCE app and sending the emails accordingly
  • listening for bounces and complaints and relaying them (or rather the relevant info from them) to the GCE app

Upvotes: 0

Related Questions