Exim is a popular mail transfer agent (MTA) used on many Unix-like systems. When email delivery fails, it is crucial to identify the root cause quickly. This guide covers common causes of email delivery failures and provides step-by-step troubleshooting methods to resolve them.
1. Understanding Common Causes of Email Delivery Failures
a) DNS Misconfigurations
- Incorrect or missing MX records
- Improper SPF, DKIM, or DMARC records
- Failure to resolve recipient domain
b) Blacklisting
- IP address or domain listed on public RBLs (Real-time Blackhole Lists)
- Poor email reputation due to spam complaints
c) Incorrect Routing
- Misconfigured transport rules
- Incorrectly defined routers
- Failure to route internal or external emails properly
2. Analyzing Exim Logs
Exim maintains detailed logs that are essential for diagnosing email delivery issues. The primary log files are:
- /var/log/exim/mainlog: Records all email transactions.
- /var/log/exim/rejectlog: Logs messages rejected by Exim.
- /var/log/exim/paniclog: Logs critical errors.
Example Commands to Analyze Logs:
# Check recent email transactions tail -f /var/log/exim/mainlog # Search for errors grep -i 'error' /var/log/exim/mainlog # Find a specific message by ID grep -i 'message-id' /var/log/exim/mainlog
3. Step-by-Step Troubleshooting
a) Verify DNS Configuration
- Check MX Records:
dig mx example.com
Ensure the output lists the correct mail servers.
- Check SPF Record:
dig txt example.com | grep spf
- Check DKIM Signature: Inspect the headers of a sent email to verify the DKIM signature.
- Check Domain Resolution:
nslookup example.com
b) Check for Blacklisting
- Manual Lookup: Use tools like mxtoolbox.com or:
host 2.0.0.127.bl.spamcop.net
- Check IP Reputation: Use sender reputation tools like SenderScore or Microsoft SNDS.
c) Analyze Routing Configuration
- Review Exim Configuration:
exim -bP
- Test Email Routing:
exim -bt user@example.com
- Send a Test Email:
echo 'Test email' | mail -s 'Test' user@example.com
4. Common Errors and Solutions
a) “Unrouteable address”
- Cause: Misconfigured routers or DNS issues.
- Solution: Verify router configuration in
/etc/exim/exim.conf
and ensure domain resolves correctly.
b) “Relay not permitted”
- Cause: Incorrect relay settings.
- Solution: Ensure the domain is listed in
local_domains
orrelay_to_domains
.
c) “451 Temporary local problem”
- Cause: Insufficient disk space or resource limits.
- Solution: Check disk usage and system resources.
df -h free -m
5. Useful Tools for Troubleshooting
- exim -qff: Force a queue run for frozen messages.
- exim -bp: Check the message queue.
- exiqgrep: Filter the message queue.
- swaks: Send test emails with specific parameters.
Example usage:
swaks --to user@example.com --server mail.example.com
By systematically analyzing logs, verifying DNS records, and using these troubleshooting techniques, you can quickly diagnose and resolve Exim email delivery issues.