CONSOLE
Loading
Resolve outgoing connection hangs, unblock egress ports on AWS EC2, DigitalOcean, and GCP, and configure rock-solid STARTTLS relaying in minutes.
SMTP connection timeouts occur when outgoing TCP SYN packets fail to receive an acknowledgment (SYN-ACK) from the destination mail server within 30 to 60 seconds. In over 80% of cloud-hosted applications (AWS EC2, DigitalOcean, Linode, Google Cloud), this is caused by cloud providers silently dropping outbound traffic on TCP port 25. To fix it, switch to Port 587 with STARTTLS or Port 465 with SSL/TLS, and route traffic through an authenticated smart host relay.
When your backend application or local Mail Transfer Agent (MTA) attempts to send an email, it initiates a standard TCP three-way handshake:
220 service banner.
If an intermediate firewall or ISP gateway silently drops the initial SYN packet without returning an immediate RST (reset) packet, your client socket remains in the SYN_SENT state until the system TCP timeout expires. This generates errors such as:
Connection timed out [errno 110]
Error: Connection timeout after 30000ms
stream_socket_client(): unable to connect to tcp://smtp.example.com:25 (Connection timed out)
Net::SMTP: Connection timed out at /usr/share/perl5/Net/SMTP.pm
If your web server is hosted on modern cloud infrastructure, outbound TCP port 25 is blocked by default at the hypervisor level:
| Cloud Host | Port 25 Default Policy | Removal Process | Recommended Workaround |
|---|---|---|---|
| AWS EC2 | Strictly Blocked | Requires manual AWS support request form with reverse DNS verification | Use Port 587 or 465 via authenticated relay |
| DigitalOcean | Strictly Blocked | Permanently blocked on new accounts to prevent spam abuse | Use third-party SMTP relay on Port 587 |
| Google Cloud (GCP) | Strictly Blocked | Outgoing port 25 is never permitted on Compute Engine | Route via authenticated SMTP smart host |
| Linode / Akamai | Blocked by Default | Requires manual ticket and identity check | Switch to Port 587 with STARTTLS |
ufw or iptables), the cloud provider drops the egress packets before they ever leave their data center.
Before modifying application code, run these three diagnostic commands from your server terminal to pinpoint whether the block is at the DNS, TCP socket, or TLS handshake layer.
Verify if a TCP socket can complete the handshake to the mail server on submission port 587:
# Test Port 587 (Submission)
nc -zv mail.photonrelay.com 587
# Expected Success Output:
# Connection to mail.photonrelay.com 587 port [tcp/submission] succeeded!
Confirm that SSL/TLS certificates and cipher suites negotiate cleanly without timing out:
openssl s_client -connect mail.photonrelay.com:587 -starttls smtp -crlf
# Look for:
# 250-STARTTLS
# SSL-Session: Protocol TLSv1.3, Cipher TLS_AES_256_GCM_SHA384
# Verify return code: 0 (ok)
If netcat hangs indefinitely, trace the network path to detect where packets are being dropped:
traceroute -p 587 -T mail.photonrelay.com
Once you confirm Port 587 or 465 is reachable from your host, update your application's SMTP parameters:
const nodemailer = require('nodemailer');
const transporter = nodemailer.createTransport({
host: "mail.photonrelay.com",
port: 587,
secure: false, // true for 465, false for 587
auth: {
user: process.env.PHOTON_SMTP_USER,
pass: process.env.PHOTON_SMTP_PASSWORD
},
connectionTimeout: 10000 // 10s timeout safeguard
});
MAIL_MAILER=smtp
MAIL_HOST=mail.photonrelay.com
MAIL_PORT=587
MAIL_USERNAME=your_api_user
MAIL_PASSWORD=your_api_secret
MAIL_ENCRYPTION=tls
MAIL_TIMEOUT=15
relayhost = [mail.photonrelay.com]:587
smtp_use_tls = yes
smtp_tls_security_level = encrypt
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
If you still experience timeouts even on port 587, check your local server firewall rules to ensure outbound TCP connections are permitted:
# Allow outbound Port 587 in UFW (Ubuntu/Debian)
sudo ufw allow out 587/tcp
sudo ufw allow out 465/tcp
sudo ufw reload
# Check status
sudo ufw status verbose
In AWS EC2, navigate to EC2 Management Console → Security Groups → Outbound Rules and ensure your security group includes an outbound rule for TCP port 587 (or all traffic) to 0.0.0.0/0.
PhotonRelay provides globally distributed Anycast edge relay endpoints on ports 587, 465, 2525, and 8025. Send high-volume transactional emails with sub-700ms delivery and zero cloud port blocks.
Trademark Notice & Nominative Fair Use: All third-party trademarks, logos, and service marks (SendGrid®, Mailgun®, Amazon SES®, Postmark®, Resend®, Brevo®, SMTP2Go®, SparkPost®) are property of their respective owners and used under 15 U.S.C. § 1115(b)(4).
Photon Console is independent and not affiliated with or endorsed by these providers. Pricing and plan details compiled from public sources as of November 2026. Read full legal disclaimer →