I am running Exim 4.71. I want to:

  1. Route all email from A.com through mail.A.com
  2. Route all email from [B-E].com through mail.B.com
  3. Send all other email directly.

Here is the configuration I have that doesn't work like I hoped:

domainlist a_domains = a.com
domainlist b_domains = b.com : c.com : d.com : e.com

begin routers

  driver = manualroute
  domains = +a_domains
  transport = remote_smtp
  route_list = +a_domains mail.a.com

  driver = manualroute
  domains = +b_domains
  transport = remote_smtp
  route_list = +b_domains mail.mollenhour.com

  driver = dnslookup
  domains = ! +local_domains
  transport = remote_smtp
  ignore_target_hosts = :

When I send an email e.g. with PHP's mail() or Zend_Mail_Transport_Smtp setting both From: and Return-Path: as user@a.com, the smart_route_a router is not used, the dnslookup is used instead. Disabling dnslookup results in no mail being sent.

From the logs it appears that email sent to someone@a.com uses smart_route_a, but the same email sent from user@a.com to user@gmail.com is sent using dnslookup.

How do I make email from user@a.com be relayed via mail.a.com?

1 Answer 1


Use a conditional like

route_list = * "${if match{$header_from:}{\N.*\.a\.com$\N} {mail.a.com}}"

domains = only checks the destination domain not the source domain.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.