Check Email Logs First
# Mail log location
sudo tail -f /var/log/mail.log # Debian/Ubuntu
sudo tail -f /var/log/maillog # CentOS/RHEL
sudo journalctl -u postfix -f # Postfix with systemd
Common Causes
1. SMTP Port Blocked
Many ISPs block port 25 (outbound SMTP):
# Test connection
telnet gmail-smtp-in.l.google.com 25
# If fails, use port 587 (submission) with authentication
2. No Reverse DNS (PTR Record)
Many email servers reject mail without PTR:
# Check PTR
dig -x YOUR_SERVER_IP
Contact Hostxpeed to set PTR record for your IP.
3. SPF/DKIM/DMARC Missing
Add DNS records:
# SPF example
v=spf1 ip4:YOUR_SERVER_IP include:spf.your-email-provider.com ~all
# Verify SPF
dig TXT yourdomain.com
4. IP Blacklisted
# Check blacklists
https://mxtoolbox.com/blacklists.aspx
5. Mail Service Not Running
# Postfix
sudo systemctl status postfix
# Sendmail
sudo systemctl status sendmail
# Exim
sudo systemctl status exim4
Test Email Sending
# Using mail command
echo "Test email body" | mail -s "Test Subject" recipient@example.com
# Using sendmail
sendmail recipient@example.com <
WordPress Email Fix
Use SMTP plugin instead of PHP mail():
- WP Mail SMTP
- Easy WP SMTP
Configure with external email service (SendGrid, Mailgun, SES).
PHP Mail Configuration
# Check sendmail_path in php.ini
sendmail_path = /usr/sbin/sendmail -t -i