Re: [exim] Smart Host routing except for certain messages

Top Page
Delete this message
Reply to this message
Author: Chris Siebenmann
Date:  
To: Ken Robinson
CC: Exim-users, cks
Subject: Re: [exim] Smart Host routing except for certain messages
> I have a cPanel/WHM host and it has been set up to route all email
> except for local messages via a smart host. I would like to modify the
> routing so that certain messages identified either by a particular
> message header or the "to" email address are not routed to the smart
> host, but are served locally or by another smart host.
>
> I have been looking at the documentation for months, but I'm really
> not sure how to proceed.


The general facility you need is conditional routers. Depending on
how you find it easiest, you can either make your send_via_sendgrid router
have condition(s) that exclude the addresses that you want to handle
specially and then put the routers that handle the special addresses
after send_via_sendgrid, or you can put your special address routers
first with conditions that only match the addresses they're interested in.

In general, the way to do sophisticated things with Exim routing is
to think of routers as (conditional) steps or decision points in a
peculiar programming language that routes email. One way to do this
is to start out by writing down your routing conditions in relatively
plain language, then figure out how to translate the various 'if address
like this, do ...' blocks into routers with appropriate conditions and
handling rules.

I've tried to write a longer and perhaps more comprehensible
explanation of this shift in mindset here:

    https://utcc.utoronto.ca/~cks/space/blog/sysadmin/EximRouterPower


(Unfortunately I don't have any handy examples of (ab)using routers like
this lying around right now.)

    - cks