If email sent from your server is not being delivered, the problem usually lies in SMTP configuration, DNS records, or IP reputation. This guide walks through the most common causes and solutions.
Common Causes
Step 1 — Check if SMTP Is Running
# Check if a mail service is installed
sudo systemctl status postfix # or sendmail, eximIf no mail service is installed:
sudo apt install postfix -y # Ubuntu/Debian
sudo dnf install postfix -y # CentOS/AlmaLinux
sudo systemctl enable postfix
sudo systemctl start postfixStep 2 — Send a Test Email
echo "Test email from server" | mail -s "Test" [email protected]Check the mail log:
sudo tail -50 /var/log/mail.log # Ubuntu/Debian
sudo tail -50 /var/log/maillog # CentOS/AlmaLinuxLook for error messages that explain why delivery failed.
Step 3 — Check DNS Records
SPF Record
SPF tells receiving servers which IPs are authorized to send email for your domain:
dig example.com TXT +shortYou should see something like:
"v=spf1 ip4:203.0.113.10 -all"If missing, add a TXT record to your DNS:
- Type: TXT
- Name: @
- Value:
v=spf1 ip4:203.0.113.10 -all
Reverse DNS (PTR Record)
dig -x 203.0.113.10 +shortThe result should match your mail hostname (e.g., mail.example.com). Set up reverse DNS through your Data Mammoth dashboard.
DMARC Record
Add a DMARC record for email authentication reporting:
- Type: TXT
- Name:
_dmarc - Value:
v=DMARC1; p=quarantine; rua=mailto:[email protected]
Step 4 — Check Port Connectivity
Test if port 25 (SMTP) is open outbound:
telnet smtp.gmail.com 25If it times out, outgoing SMTP may be blocked. Try ports 587 or 465 instead by configuring your application to use an external SMTP relay.
Using an SMTP Relay
If direct sending is blocked or unreliable, use an external SMTP service:
Configure your application to send through an SMTP relay:
- Host: Your SMTP provider's server
- Port: 587 (TLS) or 465 (SSL)
- Authentication: Your SMTP credentials
Step 5 — Check IP Reputation
Your server's IP may be on a blocklist if it was previously used for spam:
Step 6 — Check Firewall Rules
Ensure outgoing SMTP ports are not blocked:
# UFW
sudo ufw allow out 25/tcp
sudo ufw allow out 587/tcp
sudo ufw allow out 465/tcpfirewalld
sudo firewall-cmd --permanent --add-port=25/tcp
sudo firewall-cmd --permanent --add-port=587/tcp
sudo firewall-cmd --reloadStep 7 — Check Application Configuration
If using PHP:
# Test PHP mail function
php -r "mail('[email protected]', 'Test', 'PHP mail test');"If using WordPress or another CMS, install an SMTP plugin that sends through an authenticated SMTP server instead of the PHP mail() function.
Prevention
mail() function.What to Do Next
- Server Networking — IPs, DNS, Reverse DNS — Configure DNS and PTR records.
- DNS Not Resolving — Fix DNS configuration issues.
- Adding Additional IP Addresses — Get a dedicated email IP.
- How to Submit a Support Ticket — Get help with email issues.