Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

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

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

dnslookup:
  driver = dnslookup
  domains = ! +local_domains
  transport = remote_smtp
  ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
  no_more

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?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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