Skip to content
Hosting Operations6 min read

Email Not Sending? 7 Fixes That Actually Work

Fix email not sending issues fast. Check MX records, SPF, and logs. This guide covers 7 practical steps to restore outbound mail flow.

Written by Abdul AbrorTechnical Hosting Support Engineer
closeup of mail app icon on phone
On this page

TL;DR — Key takeaways

  • Check your mail logs first; 80% of 'email not sending' issues are visible in /var/log/maillog or /var/log/syslog.
  • Verify SPF, DKIM, and DMARC records align with your sending domain to prevent rejection by major providers.
  • Ensure port 25 is not blocked by your ISP or cloud provider; use port 587 with STARTTLS if 25 is restricted.
  • Test with a local recipient first to isolate whether the issue is local configuration or remote rejection.
  • Restart the mail service (postfix/sendmail) only after backing up configuration files to avoid breaking existing routes.

Email not sending is one of the most common support tickets I handle. The error message is usually vague, but the root cause is almost always visible in the logs.

This guide walks you through the seven most frequent causes and how to fix them. No fluff, just the commands and checks that actually work.

Check the Mail Logs First

Before touching any configuration, look at the logs. In support tickets I handled, the usual culprit was a full disk or a misconfigured relay. The logs tell you exactly what happened.

On most Linux systems, the mail log is at /var/log/maillog or /var/log/syslog. Search for your domain name or the timestamp of the failed send. Look for lines containing 'error', 'denied', or 'refused'.

If you see 'relay access denied', your server is trying to send mail for a domain it isn't authorized to handle. If you see 'connection refused', the remote server is rejecting the connection, often due to IP blacklisting.

  • Use 'grep -i error /var/log/maillog | tail -20' to find recent issues.
  • Check disk space with 'df -h' to ensure /var is not full.

Verify DNS Records (MX, SPF, DKIM)

So what if the logs look clean but mail still doesn't go out? The problem is likely in your DNS. Mail servers check these records before accepting or sending mail.

MX records tell the internet where to send mail for your domain. Run 'dig MX yourdomain.com' to verify they point to your mail server. If the record is missing or points to a non-existent host, mail will bounce.

SPF records list which IPs are allowed to send mail for your domain. If your server's IP isn't in the SPF record, receiving servers may reject the mail as spoofing. Run 'dig TXT yourdomain.com' to check. Ensure your server's IP is included or that you're using an 'include' directive for your mail provider.

  • MX records must point to a valid A record or CNAME.
  • SPF records should not exceed 10 DNS lookups.
  • DKIM signatures add a cryptographic layer; verify with 'dig TXT selector._domainkey.yourdomain.com'.

Test Local Delivery

Before testing external delivery, confirm your mail server can deliver mail locally. This isolates whether the issue is with your server's core functionality or with external connectivity.

Send a test email to a local user: 'echo test | mail -s test localuser@localhost'. If this fails, your mail queue is stuck or the mail service is down. Check the status with 'systemctl status postfix' or 'systemctl status sendmail'.

If local delivery works, the issue is external. Move on to checking ports and remote rejections.

  • Local delivery tests the MTA (Mail Transfer Agent) core.
  • If local fails, restart the service: 'systemctl restart postfix'.

Check Port 25 and Connectivity

Many ISPs and cloud providers block outbound port 25 to prevent spam. If your mail server can't connect to port 25 on remote servers, mail will not send.

Test connectivity with 'telnet yourdomain.com 25'. If the connection times out, port 25 is blocked. In this case, switch your mail client to use port 587 with STARTTLS. Most modern mail servers support this, and it bypasses common blocks.

If you're on a VPS or dedicated server, check your firewall rules. Ensure outbound traffic on port 25 is allowed. Use 'iptables -L -n | grep 25' to verify.

  • Port 25 is standard for SMTP; port 587 is for submission with TLS.
  • If port 25 is blocked, use port 587 with STARTTLS in your mail client settings.
  • Check firewall rules for outbound restrictions.

Inspect the Mail Queue

If mail is stuck in the outbox, it's likely in the mail queue. The queue holds messages that couldn't be delivered immediately. A full queue can cause new mail to fail.

List the queue with 'mailq' or 'postqueue -p'. Look for messages with a long 'age' or repeated 'deferred' status. These messages are failing to deliver and are retrying.

If the queue is full, clear it carefully. Use 'postsuper -d ALL' to delete all queued mail, but only after backing up the queue directory. This is a destructive operation, so proceed with caution.

  • Use 'mailq' to list queued messages.
  • Back up /var/spool/postfix before clearing the queue.
  • Use 'postsuper -d ALL' to clear the queue if necessary.

Verify IP Reputation and Blacklists

If your server's IP is on a blacklist, receiving servers will reject mail. This is common for new servers or those that have sent spam in the past.

Check your IP against major blacklists like Spamhaus, Barracuda, and SORBS. Use online tools or run 'host -t TXT yourip.spamcop.net' to check specific lists.

If you're listed, request removal from the blacklist. This can take hours or days. In the meantime, consider using a different IP or a mail relay service to send mail.

  • Check IP reputation with online blacklist checkers.
  • Request removal from blacklists if listed.
  • Consider using a mail relay service if your IP is blacklisted.

Restart the Mail Service (Last Resort)

Restarting the mail service can resolve temporary glitches, but it should be your last resort. It can also break existing configurations if not done carefully.

Before restarting, back up your configuration files. For Postfix, copy /etc/postfix/main.cf to a safe location. Then restart the service with 'systemctl restart postfix'.

After restarting, check the logs again to ensure the service started correctly. If the issue persists, the problem is likely in your configuration or DNS, not the service itself.

  • Back up /etc/postfix/main.cf before restarting.
  • Use 'systemctl restart postfix' to restart the service.
  • Check logs after restarting to confirm the service is running.

Quick troubleshooting checklist

  • Check /var/log/maillog for 'relay access denied' or 'connection refused' errors.
  • Run 'dig MX yourdomain.com' to confirm DNS records point to the correct mail server.
  • Verify SPF record includes all sending IPs: 'dig TXT yourdomain.com'.
  • Test local delivery: 'echo test | mail -s test localuser@localhost'.
  • Check if port 25 is blocked: 'telnet yourdomain.com 25'.
  • Review .exim or /var/spool/mail for stuck queues.
  • Restart mail service only after backing up /etc/postfix/main.cf.

FAQ

Why is my email stuck in the outbox?

The mail server is likely rejecting the connection due to an SPF mismatch, a blocked port, or a full disk. Check the mail logs for specific error codes like 550 or 421 to identify the exact cause.

How do I check if my SPF record is correct?

Run 'dig TXT yourdomain.com' and ensure the output includes 'v=spf1' followed by all your sending IPs or include directives. If the record is missing or malformed, update your DNS zone file.

What should I do if port 25 is blocked?

Switch your mail client to use port 587 with STARTTLS encryption. Most modern mail servers support this, and it bypasses common ISP blocks on port 25 without requiring network changes.