cPanel Email Not Sending: Fix SMTP Port & Queue Blockage
Emails stuck in queue or failing to send? Usually a blocked port (587/465) or Exim crash. Here's how to fix it quick.
Quick Answer
Check if port 587 or 465 is open from your server (telnet mail.yourdomain.com 587). If blocked, contact your host or open it in CSF/iptables. Then restart Exim: service exim restart and flush queue: exim -Mrm $(exim -bp | grep frozen | awk '{print $3}').
Why This Happens
This is the most common cPanel email issue I see — clients can receive mail fine, but sending fails. Nine times out of ten, it's a blocked port, usually 587 (submission) or 465 (smtps). Hosting providers love to lock these down thinking they're stopping spam, but they break things. Other times, Exim itself crashes or the queue gets jammed with frozen messages. Had a client last month whose entire team couldn't send invoices for two days — turned out their firewall rules got reset after a cPanel update. No port 587, no outgoing mail. Simple fix once you know where to look.
Fix Steps (In Order)
- Check SMTP ports from outside the server. Run this from a local machine or another server:
telnet mail.yourdomain.com 587
If it hangs or says "Connection refused", port's blocked. Try 465 same way. If both fail, that's your culprit. - Verify Exim is running. SSH into the server and run:
service exim status
If it shows "stopped" or "dead", start it:service exim start. If it won't start, check exim logs:tail -100 /var/log/exim_mainlog | grep -i error. Usually a config typo or disk space issue. - Flush the queue. Frozen emails can block new ones. Run:
exiqgrep -z -i | xargs exim -Mrm
This removes all frozen messages. Then check queue size:exim -bpc. Should be under 10. - Restart Exim cleanly. Kill stuck processes first:
pkill -9 exim
Thenservice exim restart. Wait 30 seconds, then test sending an email from webmail or a client like Thunderbird. - Check cPanel mail logs. Look at:
tail -50 /var/log/exim_mainlog | grep -E '(denied|rejected|failed)'
Common errors: "Connection timed out" (port blocked), "Unrouteable address" (DNS issue), "Spam score exceeded" (content filter).
Alternative Fixes If Main Steps Don't Work
- Firewall rules in WHM. Go to WHM > ConfigServer Security & Firewall (CSF) > Firewall Allow IPs. Add your server IP and the mail server IP. Also check:
csf -rto reload rules. - Check if MailSniffer or greylisting is interfering. WHM > Service Manager > Turn off Mail Delivery Queue Runner temporarily. Re-enable after test.
- Test with a raw telnet session. From the server itself, try:
echo -e 'EHLO test\nQUIT' | nc localhost 25. If that works but external fails, it's a firewall, not Exim. - Check disk space.
df -h— if /var is full (over 90%), Exim can't write logs or spool. Clean up old logs:ls -lt /var/log/exim_*log*and remove old ones. - Update Exim config. In WHM > Exim Configuration Manager, look under "Access Lists". Make sure "require verify = sender/callout" is off — it slows things and can cause timeouts.
Prevention Tip
Set up a cron job to monitor the queue every 15 minutes. Add this to /etc/crontab:
*/15 * * * * root /usr/sbin/exiqsumm | grep -q '0 frozen' || (echo 'Exim queue has frozen messages' | mail -s 'Exim Alert' you@domain.com)
This emails you if anything gets stuck. Also, always test port 587 from an external network after any firewall change — because you will forget, and you'll get that panicked call at 10 PM on a Saturday. Trust me.
Was this solution helpful?