Why Email Won't Send From DigitalOcean Droplets — And How to Fix It 2026
พอร์ต SMTP ถูกบล็อกทุก Droplet โดยดีฟอลต์ — นี่คือวิธีแก้
Contents
- The Problem: Email Won't Send From Your Droplet
- Which Ports Are Blocked
- Why DigitalOcean Blocks SMTP Ports
- Why You Shouldn't Run Your Own Mail Server
- The Better Way: Use an SMTP Relay Service
- How to Connect SMTP Relay to Your App
- Requesting Port Unblocking From DigitalOcean
- Alternate Ports
- Pre-Deployment Checklist for Email Systems
- FAQ
The Problem: Email Won't Send From Your Droplet
Many DigitalOcean users hit the same wall: outbound email fails even with correct SMTP settings, because the platform blocks mail ports at the network level.
- Happens even with flawless SMTP configuration
- Not your code, not your mail library
- It's a platform-wide policy affecting every Droplet — no automatic exceptions
Which Ports Are Blocked
From multiple reviews, digitalOcean blocks the standard SMTP ports 25, 465, and 587 on every Droplet by default, including traffic through a Reserved IP.
- Port 25: Unencrypted standard SMTP (server-to-server mail)
- Port 465: SMTP over SSL
- Port 587: SMTP Submission (client-side mail)
- Blocked on every Droplet, even with a Reserved IP attached
Why DigitalOcean Blocks SMTP Ports
The block exists to prevent spam and abuse — an open port 25 across a cheap cloud provider's IP ranges quickly gets blacklisted, harming every legitimate user on the same range.
- Prevent Droplets from being turned into spam cannons
- Protect the reputation of the entire IP range
- Keep legitimate users from getting blacklisted with the platform
Why You Shouldn't Run Your Own Mail Server
Even with the port unblocked, DigitalOcean itself advises against self-hosting a mail server — securing and maintaining IP reputation is an ongoing, complex job.
- You need correct SPF, DKIM, DMARC setup or your email lands in spam
- Continuous monitoring to keep your IP off blacklists
- Consumes more server resources and maintenance time than you'd expect
The Better Way: Use an SMTP Relay Service
In practice, the practical fix is switching to a third-party email service provider — they handle IP reputation and deliverability, and connect via API or SMTP relay on non-blocked ports.
- SendGrid, Mailgun, Postmark, Amazon SES — developer favorites
- Most offer a free tier for testing and small projects
- Connect via SMTP relay (using the provider's port, not 25) or API
- Built-in deliverability, bounce handling, and open/click analytics
How to Connect SMTP Relay to Your App
Sign up with a provider, get SMTP credentials or an API key, plug them into your app's mail config, then send a test email before going live.
- Sign up with your chosen SMTP relay provider
- Copy SMTP host/port/username/password (or API key) into your app's mail config
- Verify your domain with the provider (add DNS records as instructed) for better deliverability
- Send a test email before deploying to production
Requesting Port Unblocking From DigitalOcean
From multiple reviews, you can contact Support to ask about unblocking, but it's not guaranteed and is reviewed case by case — using an SMTP relay from the start is usually faster.
- File a Support ticket in your Control Panel
- No guarantee — it's a platform-wide spam policy
- The review process often takes longer than just switching to SMTP relay
- For speed, just use a third-party SMTP service from the start
Alternate Ports
Some SMTP relay providers support alternate ports like 2525 to sidestep commonly-blocked cloud ports — check your provider's docs.
- Port 2525 is an alternative supported by some providers
- Check your provider's documentation first to verify support
- You're still going through a third-party service — it's not unblocking port 25 directly
Pre-Deployment Checklist for Email Systems
Run through this checklist before going live so critical transactional emails don't get lost.
- Confirm you're using SMTP relay or an Email API, not a local mail server
- Verify your domain and configure SPF/DKIM as the provider specifies
- Test sending emails in all critical flows (signup, password reset, receipt)
- Set up monitoring/webhooks for failed sends (bounces, failures)