I'm looking at have exim redirect a subset of mail to one of our smarthosts based on the looked up mx record. Currently I can do this by specifying all of the domains and using a manualroute router, but I'd like it to be automatic going forward.


DNS => Domain1.com in mx 10 subhost.outdomain.com

Exim would then need to have a condition in the manualrouter based on that mxdomain.

Anyone know how to do this without an external script? Exim already knows the mx_domain while processing so it should be about to do it.

2 Answers 2


As far as I'm aware, exim only becomes aware of the MX record in a destination domain when it attempts SMTP delivery via the SMTP transport. What you need to route the mail to a different transport depending on the value of the MX record.

I don't believe there's any way to get a router to know the MX record of the destination domain without using an external script. I'm prepared for someone to come along and tell me I'm wrong though...


The route_data variable is expanded, so you can use

route_data = ${lookup dnsdb{>: mxh=Domain1.com}{$value}fail}

It doesn't respect MX priotities, as I haven't found out how to sort in string expansions.

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.