How to Fix Exim Email Delivery Failure Error
In this tutorial, you'll learn about How to Fix Exim Email Delivery Failure Error. We cover key concepts, practical examples, and best practices.
Exim mail delivery fails with remote host address is the local host or Connection refused — the router or transport configuration is incorrect for delivering to external domains.
The Problem
2026-06-24 10:00:00 [1234] H=mail.recipient.com [10.0.0.1]:
Connection timed out
2026-06-24 10:00:00 [1234] ** user@recipient.com:
R=lookuphost T=remote_smtp: SMTP error: connection timed out
Step-by-Step Fix
Step 1: Check the mail queue
sudo exim -bp
Step 2: View message details
sudo exim -Mvl QUEUE_ID
Step 3: Force delivery attempt
sudo exim -q -v
Step 4: Test DNS resolution
host recipient.com
dig mx recipient.com
Step 5: Check routers configuration
# /etc/exim4/conf.d/router/200_exim4-config_primary
begin routers
dnslookup:
driver = dnslookup
domains = ! +local_domains
transport = remote_smtp
ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
no_more
Step 6: Check transports configuration
begin transports
remote_smtp:
driver = smtp
port = 25
hosts_require_auth = <; ;
hosts_require_tls = <; ;
Step 7: Flush queue
sudo exim -qff
Prevention Tips
- Monitor queue length with
sudo exim -bpc - Set
queue_run_maxto control parallel deliveries - Configure retry rules in
/etc/exim4/conf.d/retry/retry.conf - Use
exiwhatto check Exim process status
Common Mistakes with delivery fail
- Misunderstanding that
Stringis[Char]with poor performance for large text operations - Using
foldlinstead offoldl'causing stack overflow on large lists - Forgetting
deriving (Show, Eq)on custom data types needed for debugging
These mistakes appear frequently in real-world EXIM code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.
Practice Exercise
Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.
This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.
FAQ
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro