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 [email protected], 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 [email protected] uses smart_route_a, but the same email sent from [email protected] to [email protected] is sent using dnslookup.

How do I make email from [email protected] 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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .