Emails Not Sent
Email delivery problems from a VPS are very common. Here are the most frequent causes and how to resolve them.
Port 25 blocked
The most common cause. Port 25 (SMTP) is blocked by default on VPS to prevent spam. This block is at the network level, not the server's firewall.
How to verify:
telnet smtp.gmail.com 25
# If it times out, port is blocked
Solution: Use port 587 (submission) or 465 (SMTPS) instead of 25 to send emails through an external SMTP relay.
If you need to unblock port 25 for a dedicated mail server, contact support with a valid reason. The unblock is evaluated case by case.
Emails end up in SPAM
Most common causes:
1. IP in blacklist
Check if your IP is blacklisted:
If you're blacklisted, follow the delisting procedure specific to each list.
2. Reverse DNS not configured
Many mail servers reject emails if the PTR record is not configured. See: Reverse DNS
Verify:
host SERVER_IP
# Must respond with a hostname, not "does not exist"
3. SPF not configured
Add an SPF record in your domain's DNS to authorize your IP to send emails:
TXT @ "v=spf1 ip4:SERVER_IP ~all"
Or if you use a relay:
TXT @ "v=spf1 include:_spf.relay-example.com ~all"
4. DKIM not configured
DKIM adds a digital signature to emails. If not configured, emails are more likely to end up in spam.
5. DMARC not configured
Add a DMARC record in your DNS:
TXT _dmarc "v=DMARC1; p=none; rua=mailto:postmaster@example.com"
- MXToolbox Blacklist Check
- MultiRBL
Complete email configuration test
Use mail-tester.com:
- Go to the site and get a temporary email address
- Send a test email to that address
- Return to the site and see the score and issues detected
Use external SMTP relay (recommended solution)
To send reliable emails from a web application, it's recommended to use an external SMTP relay like:
These services manage IP reputation and guarantee deliverability. Just use SMTP credentials in your CMS or application.
- SendGrid: 100 emails/day free
- Mailgun: 1000 emails/month free
- Amazon SES: very economical
- Brevo (ex Sendinblue): 300 emails/day free
- Postmark: excellent deliverability
Postfix configuration with SMTP relay
If you use Postfix as mail server:
nano /etc/postfix/main.cf
Add:
relayhost = [smtp.sendgrid.net]: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
nano /etc/postfix/sasl_passwd
[smtp.sendgrid.net]:587 apikey:YOUR_API_KEY
postmap /etc/postfix/sasl_passwd
chmod 600 /etc/postfix/sasl_passwd
systemctl restart postfix
WordPress doesn't send emails
WordPress uses PHP mail() function which often doesn't work on VPS. Install an SMTP plugin:
- Install WP Mail SMTP or FluentSMTP plugin
- Configure it with your external SMTP relay credentials
- Test sending from the plugin page
Related articles
Locked Out of VPS
Complete guide to recover server access when locked out, with step-by-step instructions from VNC Console
Server Unreachable
What to do when server is not responding or you can't connect via SSH
Website Not Reachable
What to do when website is not responding, shows errors, or is unreachable
