Re: [exim] smart hosts per domain

Top Page
Delete this message
Reply to this message
Author: Mike Cardwell
Date:  
To: exim-users
Subject: Re: [exim] smart hosts per domain
Adrian Baxter wrote:

> I have a rented server sitting with an isp and its using exim to manage
> mail services, I'd like to configure it to use a managed external smart
> host service to scan the mail sent to and from the domain for viruses &
> spam. I have multiple domains on this server and I'd like to be able to
> set the smart host usage on a per domain level if possible.
>
> If one domain sends to another domain that also exists on the same
> server I'd like to force it to send it via the external smart host.
>
> Is this possible with exim, do you need more information, let me know if
> you can help?


Yes, all of that is possible with Exim. You would need to set up a
manualroute router as described here:

http://www.exim.org/exim-html-current/doc/html/spec_html/ch20.html

You would add a condition to the router to detect if the domains were
different, with something like:

condition = ${if !eq{$domain}{$sender_address_domain}}

You could store a list of domains which you want to filter, in a file
and then add an option like this to the router:

domains = lsearch;/path/to/file

Alternatively you could do some other type of lookup, as per:

http://www.exim.org/exim-html-current/doc/html/spec_html/ch09.html

Finally, you'd need to make sure that mail that comes from the filtering
host, doesn't get routed back to it, causing a loop. I'm not sure this
is the best way of doing it, but I'd update the first condition that I
mentioned earlier in the email as follows:

condition = ${if and{{\
    !eq{$domain}{$sender_address_domain}\
}{\
    !eq{$sender_host_address}{ip.address.of.filtering.host}\
}}}


I really wish you could add multiple "condition" options to a router so
you didn't have to create messy configuration like that.

--
Mike Cardwell
(https://secure.grepular.com/) (http://perlcv.com/)