Google Compute Engine (GCE) email delivery solution? - google-compute-engine

I've just setup several instances on Google Compute Engine and getting trouble with email delivery system since GCE blocks outbound connections on ports 25, 465, and 587.
GCE provides details solution at: https://developers.google.com/compute/docs/networking#mailserver to using postfix to send email via smtp.gmail.com using Google Account.
The problem is Gmail has its own sending limits and it will be a big problem for high traffic website which need to send email notifications heavily.
Is there anyone has a solution to send more higher sending limits for GCE instances?
Thanks in advance.
Best Regards,
T

From the same page:
Blocked Traffic
Traffic on these ports to and from the Internet are blocked or
restricted for all Google Compute Engine instances. If you think you
have a compelling reason to allow this traffic, please contact the
Google Compute Engine team at gc-team#google.com.
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
https://developers.google.com/compute/docs/networking#blockedtraffic
It looks like you'll need to have a compelling reason to allow the traffic for your application; I'm presuming that hitting GMail delivery limits might be a reason. Note that companies like SendGrid also offer email delivery and management (bulk email as a service) with an HTTP interface that you could call from GCE.

We've updated our documentation to include SendGrid as an additional option. You probably want to take another look.
https://developers.google.com/compute/docs/sending-mail?hl=en

Your best option is to sign up for Amazon SES and get the API credentials and endpoint to send mail from google cloud without any google limitations.
You can use any similar API as well.

Related

Send emails from GCP compute instance using smtp-relay of GMAIL

I am trying to send mail from a compute instance using Gmail's smptp relay and I have enabled smtp-relay through my GSuite account and have also configured POSTFIX in my compute instance and as per mail.log file the mail has been delivered but it is not appearing in my Gmail box. Could you please let me know what is being missed?
Here is the log for the same.
At first, have a look at the Firewall rules overview where at section Always blocked traffic you can find that:
Google Cloud always blocks the traffic that is described in the
following table. Your firewall rules cannot be used to allow any of
this traffic:
So, you should follow documentation Choosing an email service to use:
To use a G Suite domain: Follow the instructions for SMTP relay
service settings in the G Suite documentation. SMTP relaying through G
Suite is only allowed through ports 465 or 587.Port 25 is not
supported through G Suite.
and use ports 465 or 587 to connect to G Suite.
Also have a look at this guide SMTP relay: Route outgoing non-Gmail messages through Google:
In the Allowed senders section, select the users who are allowed to
send messages through the SMTP relay service:
Only registered Apps users in my domain—The sender must be a registered user in one of your domains.
Only addresses in my domains—The sender doesn't have to be a recognized G Suite user, but must be in one of your registered
domains. This can be useful when you have third-party or custom
applications that need to send messages.
Any addresses (not recommended)—The sender address can be anything, even an address outside of your domain.
Important: The Any addresses option makes you more vulnerable to abuse,
either through malware on your user’s machines or by
misconfiguration of your SMTP infrastructure. Therefore, we don't
recommend this option.
and check who is allowed to send emails, then follow next step:
In the Authentication section, check one or both boxes to set an authentication method:
Only accept mail from the specified IP addresses—The system only accepts mail sent from these IP addresses as coming from your domains.
Require SMTP Authentication—Enforces the use of SMTP authentication to identify the sending domain. Using this option
requires your clients to connect via TLS.
and check if you use whitelisted your instances.
In addition, this example could be useful to check your steps.
In case if you still have an issue, check possible alternatives SendGrid:
This tutorial shows how to use SendGrid to send email from an app
running on a Compute Engine instance. SendGrid is a third-party email
service that offers Compute Engine users a free trial with 12,000
transactional emails free each month.
or Mailgun, or Mailjet. If they work for you, but you still need G Suite you can contact G Suite Support. It they don't work for you also - you should check you Postfix configuration first.

Google Compute instance receiving email

I'm looking to run a mail server on a Google Compute Engine instance, and have discovered Google's blockage of port 25, 465, and 587. I'll probably use Mailjet for outgoing mail. Anyone found a good solution for incoming mail?
Email messages sent to your app are implemented as HTTP requests containing MIME data. To process incoming email messages, you associate email addresses with script handlers in your app configuration, then include the handlers in your app's code.
The link below is for python but there is no restriction on language.
https://cloud.google.com/appengine/docs/standard/python/mail/receiving-mail-with-mail-api

Unable to send mails with SMTP in GCE instances

While migrating from AWS EC2 instances to Google Compute Engine instances we got problems with sending emails via SMTP (Sendgrid).
I read a lot about it and read that the ports (587, 462, 25) of SMTP are blocked... And to read this article.
https://cloud.google.com/compute/docs/tutorials/sending-mail/#sending_mail_through_corporate_mail_servers
Questions:
For my understanding we should open a Cloud Launcher of SendGrid?
If (1) = yes, then I see it (the cloud launcher) does not support C# and our code today of sending emails is based on C#. So that we will have to change the code to one of those: Node.js, Python, Ruby, Go & PHP?
Is there any way to unblock this outbound connections on port 587 (or 462, 25)? Without Cloud Launcher.
Thanks in advance
1) Yes, if you want to use it through google. If not I recommend directly going to one of the smtp providers such as sendgrid, spakpost, mandrill... to get and account and use their smtp service to send mail.
2) You can use C# by simply not using the Cloud Launcher and purchasing an account directly from the vendor and usning their SMTP service.
3) No, port 2525 is free to send outbound emails to smtp providers through GCP so I highly recommend using that since it can be used for sendgrid as well.

How to enable SMTP port 25 in Google Cloud Redhat 7 instance? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I am using webmail to configure the mail service. the webmail to any external mail providers(gmail,yahoo) is not working. the serviceis working fine within webmail to webmail accounts. from research i found that google cloud is not allowing SMTP to connect on PORT 25.
How to solve this?
The Google documentation on sending email describes in detail all the options available for sending out email from a Google Cloud instance.
To summarize the document, Google does not allow access to port 25 from a Google instance for security reasons. All other ports can be used to send out email. If you want to send out email from port 25, then your only option is to use a VPN.
You can also use third party email providers like Mailgun and SendGrid.
Another option is to send email through a gmail or google apps account from port 465 or port 587.
As I understand you are not able to use webmail for connecting to third party email providers like Yahoo and Google. This should not be a problem now since all email providers use the ports 465 or 587 for sending out email. These ports are allowed by Google
Google Compute Engine has outgoing SMTP ports blocked by design. Please vote here to get Google's SMTP behavior changed:
https://googlecloudplatform.uservoice.com/forums/302595-compute-engine/suggestions/10079937-send-and-receive-email-using-tcp-smtp-imap-ports
Until they open the SMTP ports, there will be no good way to send email from their cloud servers. Sendgrid and the others are too expensive or lack many features that are needed.
Apparently, Port 25 is a must too, but voting to have it opened is in a different location: https://googlecloudplatform.uservoice.com/forums/302595-compute-engine/suggestions/12422808-please-unblock-port-25-allow-outbound-mail-connec
You can use port 2525 to send email from google cloud. Almost all major email service providers support port 2525. But all other smtp ports are blocked for outbound mail.
I dont think the "incoming port 25" is blocked....only "outgoing". The relay service is to stop spam going out from google cloud thhs ruining ip address reputation on their network.
Public ip addresses are not free...even for google. They must be purchased, so ip address reputation and avoiding blacklisting is very important for large service providers.
This has been done because spammers setup scripts to quickly spin up new instances, send email spam until they are blacklisted, move to a new ip address and than get blacklisted again, move to a new ip address keep on spamming...over and over again leaving a trail of blacklisted public ip addresses in their wake.

Using host's native SMTP to send emails alongside Google Apps

Current Setup
I use Google Apps for personal / non-transactional emails. MX records for my domain point to google.
I have a dedicated IP for my LAMP server, and the SMTP port is available. I use cPanel to manage the server. I have created an email account through cPanel.
Goal
I want to use my host's native SMTP for sending transactional emails. I cannot use Google Apps SMTP because of per-day limit. These transactional emails need neither be saved in sent items nor replies to such emails be monitored.
Problem Area
I am not able to send transactional mails using host's native SMTP (not able to set this up, so no errors yet!)
Q1. Is the goal (using both host's native SMTP and Google Apps)
achievable? Looking at this and this, I believe it should be.
Q2. If yes, how should I setup in my cPanel? Please let me know if more [relevant] information about server setup is required to answer this.
Q1: Yes.
Q2: Same as if you were setting it up without Google Apps. Sending mail does not require any special setup. If you are still having difficulty, you need to check with your provider or ask the question of a cpanel expert -- the problem is unrelated to Google Apps.
What you didn't ask but need to know:
Cannot deliver email to Google Apps address; Gmail receives the same email fine
Why can't my server send outgoing email?