Email Delivery Failures and SMTP Errors - How to Fix

Troubleshooting guide for email delivery failures and SMTP errors. Learn how to diagnose email issues, identify root causes, and fix SMTP delivery problems.

Last updated: 2026-01-11

Email Delivery Failures and SMTP Errors - How to Fix

Email delivery failures and SMTP errors prevent emails from being sent or received, causing communication issues and notification failures. This troubleshooting guide helps you diagnose email issues, identify root causes, and fix SMTP delivery problems.

For comprehensive email monitoring, see Email Delivery Monitoring. For monitoring email queue, see Monitor Email Queue and SMTP Status.

Symptoms of Email Delivery Issues

  • Emails not being delivered
  • SMTP connection failures
  • Email queue building up
  • SMTP authentication errors
  • Bounce messages increasing

Step 1: Check Email Queue Status

Check Email Queue

# Check Postfix queue
mailq | wc -l

# View emails in queue
mailq

# Check queue details
postqueue -p

# Check Sendmail queue
sendmail -bp

Monitor Queue Growth

# Monitor queue size over time
while true; do
  COUNT=$(mailq | wc -l)
  echo "$(date): $COUNT emails in queue"
  sleep 60
done

Step 2: Check SMTP Server Status

Test SMTP Connection

# Test SMTP server connection
telnet smtp.example.com 25

# Test SMTP with timeout
timeout 5 telnet smtp.example.com 25

# Check SMTP server response
echo "QUIT" | telnet smtp.example.com 25

Check SMTP Authentication

# Test SMTP authentication
openssl s_client -connect smtp.example.com:587 -starttls smtp

# Test SMTP with credentials
swaks --to [email protected] --from [email protected] --server smtp.example.com

Step 3: Check Email Logs

Review SMTP Logs

# View SMTP logs (Postfix)
sudo tail -100 /var/log/mail.log | grep smtp

# View SMTP errors
sudo grep -i error /var/log/mail.log | tail -20

# Check email delivery logs
sudo tail -100 /var/log/mail.log | grep -E "sent\|delivered\|failed"

# Count SMTP errors
sudo grep -i error /var/log/mail.log | wc -l

Check Email Service Status

# Check Postfix status
systemctl status postfix

# Check Sendmail status
systemctl status sendmail

# Check email service logs
journalctl -u postfix -n 50

Step 4: Identify Root Causes

Common Causes of Email Delivery Failures

  1. SMTP Server Issues:

    • SMTP server down or unreachable
    • SMTP authentication failures
    • SMTP server blocking
    • SMTP server timeout
  2. Network Connectivity Issues:

    • Network connectivity problems
    • Firewall blocking SMTP port
    • DNS resolution failures
    • Network timeout
  3. Configuration Issues:

    • Incorrect SMTP server configuration
    • Wrong SMTP credentials
    • Incorrect email relay settings
    • DNS configuration errors
  4. Email Content Issues:

    • Spam filters blocking emails
    • Invalid email addresses
    • Email size limits exceeded
    • Attachment issues

Step 5: Diagnose Specific Issues

Check SMTP Server Connectivity

# Test SMTP server connectivity
ping -c 3 smtp.example.com

# Test SMTP port connectivity
nc -zv smtp.example.com 25
nc -zv smtp.example.com 587
nc -zv smtp.example.com 465

# Test SMTP server response
telnet smtp.example.com 25

Check Email Configuration

# Check Postfix configuration
postconf -n

# Check SMTP relay configuration
postconf relayhost

# Check email domain configuration
postconf mydomain

Check DNS Configuration

# Check MX records
dig MX example.com

# Check SPF records
dig TXT example.com | grep spf

# Check DKIM records
dig TXT default._domainkey.example.com

Step 6: Fix Email Delivery Issues

Fix SMTP Server Issues

  1. Update SMTP Configuration:

    # Edit Postfix configuration
    sudo nano /etc/postfix/main.cf
    
    # Set SMTP relay
    relayhost = smtp.example.com
    
    # Restart Postfix
    sudo systemctl restart postfix
    
  2. Fix SMTP Authentication:

    # Configure SMTP authentication
    sudo nano /etc/postfix/sasl_passwd
    
    # Add SMTP credentials
    smtp.example.com username:password
    
    # Update Postfix
    sudo postmap /etc/postfix/sasl_passwd
    sudo systemctl restart postfix
    

Fix Network Connectivity

  1. Check Firewall Rules:

    # Allow SMTP ports
    sudo ufw allow 25/tcp
    sudo ufw allow 587/tcp
    sudo ufw allow 465/tcp
    
  2. Fix DNS Configuration:

    # Update DNS servers
    sudo nano /etc/resolv.conf
    
    # Add DNS servers
    nameserver 8.8.8.8
    

Fix Email Queue Issues

  1. Process Email Queue:

    # Process Postfix queue
    postqueue -f
    
    # Flush queue
    postfix flush
    
    # Retry failed emails
    postqueue -p | grep "!" | awk '{print $1}' | xargs -I {} postsuper -r {}
    
  2. Clean Up Email Queue:

    # Remove old emails from queue
    find /var/spool/postfix/deferred -type f -mtime +7 -delete
    
    # Remove bounced emails
    find /var/spool/postfix/bounce -type f -mtime +30 -delete
    

Step 7: Prevent Future Email Issues

Implement Proper Monitoring

Set up automated monitoring with Zuzia.app to track email delivery continuously:

  1. Add Email Queue Monitoring:

    mailq | wc -l
    
    • Monitor queue size
    • Alert when queue exceeds thresholds
  2. Monitor SMTP Status:

    timeout 5 telnet smtp.example.com 25 && echo "OK" || echo "FAILED"
    
    • Track SMTP server availability
    • Alert when SMTP fails

Best Practices

  1. Monitor Email Delivery:

    • Track email queue size
    • Monitor SMTP server status
    • Alert on delivery failures
    • Review email logs regularly
  2. Configure Proper SMTP Settings:

    • Use reliable SMTP servers
    • Configure SMTP authentication
    • Set appropriate timeouts
    • Implement retry mechanisms
  3. Implement Email Monitoring:

    • Monitor email delivery success rates
    • Track bounce rates
    • Review delivery failures
    • Optimize email configuration
  4. Maintain Email Infrastructure:

    • Keep SMTP servers updated
    • Monitor SMTP server performance
    • Test email delivery regularly
    • Update email configuration

FAQ: Common Questions About Email Delivery

How do I prevent email delivery failures?

Prevent email delivery failures by monitoring email queue, configuring proper SMTP settings, ensuring SMTP server availability, testing email delivery regularly, and maintaining email infrastructure.

Why do emails get stuck in queue?

Emails get stuck in queue due to SMTP server issues, network connectivity problems, authentication failures, or email content issues. Check SMTP logs and queue status to identify root causes.

How do I fix SMTP authentication errors?

Fix SMTP authentication errors by verifying SMTP credentials, updating authentication configuration, checking SMTP server settings, and ensuring proper authentication method is used.

Can email monitoring impact email delivery?

Email monitoring commands have minimal impact on email delivery when done correctly. Use appropriate monitoring frequency and avoid monitoring during peak email sending periods.

Note: The content above is part of our brainstorming and planning process. Not all described features are yet available in the current version of Zuzia.

If you'd like to achieve what's described in this article, please contact us – we'd be happy to work on it and tailor the solution to your needs.

In the meantime, we invite you to try out Zuzia's current features – server monitoring, SSL checks, task management, and many more.

We use cookies to ensure the proper functioning of our website.