0 min left
Google Cloud Blocks Port 25 - How to Send Email

Google Cloud Blocks Port 25 - How to Send Email

BulkEmailSetup
BulkEmailSetup Team
November 26, 2026
5 min read

Google Cloud blocks outbound port 25 to the internet on Compute Engine, so a VM cannot deliver mail straight to Gmail or Outlook. Ports 587 and 465 stay open. That leaves three real ways to send: a relay service on 587, Google Workspace SMTP relay if your domain is on Workspace, or a mail server on a host outside GCP that your app submits to on 587. Which one fits depends on volume: app mail at a few thousand a day suits a relay, steady bulk sending suits your own server.

What Google blocks and what it leaves open

Google's Compute Engine guide to sending email is direct about it: connections to TCP port 25 are blocked when the destination is outside your VPC network. Some projects do not have the restriction, but most do, and you should plan as if yours does.

PortTo the internet from a VMWhat it is for
25blocked by defaultserver-to-server delivery to MX records
587openauthenticated submission to a relay
465opensubmission over implicit TLS
25 inside your VPC or over VPNallowedmail between your own systems

Port 25 is walled off on Compute Engine Takeaway: a GCP VM cannot reach inboxes on port 25, so mail must go through the gate at port 587 or 465 to a relay or server outside Google Cloud, which then delivers on port 25. The wall and the gate your VM port 25: blocked 587 465 relay or own server, outside inboxes port 25 Delivery on 25 happens outside Google Cloud Port 25 is walled off; 587 and 465 are the gate

The block exists because cloud IPs are cheap to rent and were once a favourite source of spam. Blocking direct delivery forces mail through a sender that is accountable for it. The same rule shows up at most clouds; our explainer on why port 25 is blocked covers the history.

How to send email from a Compute Engine VM

There are three paths, and all of them use 587 or 465 from the VM.

PathHow it worksLimitsGood for
Relay providerapp sends to SendGrid, Mailgun or Mailjet on 587per-email pricing, shared IPs unless you pay for dedicatedapp mail, low to mid volume
Workspace SMTP relayapp sends to smtp-relay.gmail.com on 587 or 46510,000 messages per user per 24 hours, 100 recipients per transactionsystem mail from a Workspace domain
Your own server outside GCPapp sends to your server on 587, the server delivers on 25your server's capacity and IP reputationnewsletters, bulk, steady volume

Google names SendGrid, Mailgun and Mailjet in its docs and says they offer a free tier to Compute Engine customers. Check the current terms before you build on that: SendGrid retired its general free plan in 2025, as covered in SendGrid's free plan ended.

Can I run Postfix on Google Cloud?

Yes, as a relay client. Postfix on the VM accepts mail from your app, queues it, and hands it to a smarthost on port 587. That gives you local queuing and retries without needing port 25 out.

# /etc/postfix/main.cf
relayhost = [smtp.yourrelay.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt

What Postfix on Compute Engine cannot do in most projects is deliver directly to recipients' MX servers, because that is port 25 traffic. If you need a real sending server with its own IPs, run it on a host that allows port 25 and point the VM's Postfix or your app at it on 587.

To check your project, run this from the VM. A timeout means the block applies.

nc -vz -w 5 gmail-smtp-in.l.google.com 25

What is the best SMTP setup for GCP apps?

It comes down to two questions: how much you send, and whether it is app mail or marketing.

Which sending path fits a GCP app Takeaway: volume and mail type decide the path, not the cloud. Low-volume app mail suits Workspace relay or a relay, high-volume app mail suits a paid relay at about $90 for 100,000, small marketing suits a small ESP, and high-volume marketing suits a dedicated server outside GCP at $549 once plus about $11 a month. Volume vs mail type under 50K a month over 50K a month app mail marketing Workspace relay or a relay free tier 10,000 a user a day Paid relay about $90 at 100K rises with every email Small ESP campaign editor, shared IPs Own server outside GCP, 3 own IPs $549 once + about $11 a month Pick by volume and mail type, not by which cloud you are on

Costs at 100,000 emails a month, the point where the choice starts to matter:

SetupMonthly cost at 100KIPs
Mailgun Scale$90shared, dedicated extra
SendGrid Profrom $89.951 dedicated included
Workspace SMTP relayincluded in Workspace licencesGoogle's, and Google watches for spam
Own server outside GCP, Basic planabout $11 hosting after $549 once3 dedicated, yours

Relay prices climb with every email. A dedicated server's monthly cost stays flat until you outgrow its 25,000 a day, which is why the line between the two sits somewhere around 50,000 to 100,000 emails a month for most senders. Our break-even analysis has the full curve.

A setup that works on GCP

Keep the app where it is and move only the delivery step.

  1. Your app on Compute Engine, Cloud Run or GKE submits mail on port 587 with a username and password.
  2. The sending server lives on a VPS host that allows port 25, with its own dedicated IPs.
  3. SPF, DKIM and DMARC are set for your sending domain, and PTR records match the server's hostname.
  4. Bounces come back to the server, which suppresses bad addresses automatically.

That way the port 25 block never matters, and your sending reputation is tied to IPs only you use. The same pattern fixes the block on other clouds too; see AWS EC2 port 25 throttling if you also run on AWS.

How BulkEmailSetup helps

We set up a dedicated SMTP server on a host where port 25 is open, with SPF, DKIM, DMARC and PTR configured, bounce handling and a campaign platform. Your GCP app points at it on port 587 and keeps running unchanged.

PlanOne-time feeEmails per dayDedicated IPsHosting you pay your host
Basic$54925,0003about $11 a month
Advance$1,199200,00015about $49 a month

No monthly fee to us and no contact limit. Every plan has a 15-day money-back guarantee, which applies until server access is handed over. See Basic plan details or all pricing.

Frequently asked questions

Does Google Cloud allow outbound port 25?

Not to the internet, by default. Google's Compute Engine docs say connections to TCP port 25 are blocked when the destination is outside your VPC network, and that this includes SMTP relay with Google Workspace. Some projects do not have the restriction, but you cannot plan on that. Port 25 inside your VPC, a peered VPC or over Cloud VPN still works.

How do I send email from a Compute Engine VM?

Send to a relay on port 587 or 465, which Google leaves open. The relay can be a provider Google names in its docs (SendGrid, Mailgun, Mailjet), Google Workspace SMTP relay if your domain is on Workspace, or your own mail server running on a host outside GCP that allows port 25. Your app authenticates on 587 and the relay delivers to the inbox.

Can I run Postfix on Google Cloud?

Yes, as a relay client. Postfix on the VM queues mail and hands it to a smarthost on port 587 with a username and password, using the relayhost setting. What Postfix on Compute Engine cannot do in most projects is deliver straight to recipients' MX servers on port 25, because that traffic is blocked.

What is the best SMTP setup for GCP apps?

For password resets and receipts at low volume, a relay or Workspace SMTP relay is simplest. For newsletters or steady bulk volume, a dedicated SMTP server outside GCP is cheaper and keeps your reputation separate. BulkEmailSetup's Basic plan is $549 one-time for 25,000 emails a day on 3 dedicated IPs, with your app submitting to it on port 587.

Can I ask Google to open port 25?

Google's docs describe the block as the default and only note that some projects do not have it. They do not offer a simple way to switch it off, so plan your sending around ports 587 and 465. Testing from your own VM with a quick telnet or nc to an MX on port 25 tells you which case you are in.

Does Google Workspace SMTP relay work from Compute Engine?

Yes, on ports 465 or 587 only, not 25. Each Workspace user can send up to 10,000 messages in 24 hours through the relay, with a 100-recipient limit per SMTP transaction. Google monitors relay traffic for spam, so it suits app and system mail from your own domain better than bulk marketing campaigns.

Is port 2525 open on Google Cloud?

Google's docs list 587 and 465 as the open sending ports and do not promise anything about 2525. Many relays also listen on 2525, and it usually works, but test it from your VM before you depend on it. If you control the receiving server, 587 is the safe choice.

Tags

google cloud port 25 blockedcompute engine smtpgcp send emailpostfix google cloudsmtp relayport 587dedicated smtp server
BulkEmailSetup

Written by BulkEmailSetup Team

We help businesses set up their own bulk email infrastructure, dedicated SMTP servers, IP rotation, and full deliverability control. One-time setup, no monthly platform fees.

Ready to set up your email infrastructure?

Get dedicated SMTP servers, IP rotation, and expert support to scale your email sending.

View Pricing