[exim] Re: Routing based on *recipient* IP address

Top Page
Delete this message
Reply to this message
Author: Jasen Betts
Date:  
To: exim-users
Subject: [exim] Re: Routing based on *recipient* IP address
On 2023-10-26, Gandalf Corvotempesta via Exim-users <exim-users@???> wrote:
> Hi guys
>
> TL;DR: how can i route, to a specific smarthost, all email based on
> the *recipient* mx IP address ?


Yes, in your config use the dnslookup router for that smarthost use ignore_target_hosts with an
inverted host list ( that is put a ! in front of it )

hostlist iran_ips = .....

iram_mx:
driver=dnslookup
ignore_target_hosts = ! +iran_ips
route_data=address_of_your_smarthost
transport = iran_smarthost


> I can check for the remote MX in the transport, but:
> 1. i'm getting a list of multiple hosts
> 2. i need to convert one (or more) of them to IP addresses
> 3. i need to check if at least one of these IP is inside a file
> (automatically updated from ipdeny.com)


looking in a file is also possible

hostlist iran_ips = /path/to/file

--
Jasen.
🇺🇦 Слава Україні

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@???
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/