>
> For example, it it possible to do something like this:
>
> filter_forward:
> driver = manualroute
> transport = remote_smtp
> domains = !@ : +relay_to_domains
> route_data =
> ${lookup{$domain}wildlsearch{VARDIR/spool/tmp/mailcleaner/domains.list}
> }${lookup{$domain}wildlsearch{VARDIR/spool/tmp/mailcleaner/emailaddres
> s.list}}
> hosts_randomize = true
> headers_remove = X-MailCleaner-Bounce
> headers_add = X-MailCleaner-ReportURL: __REPORT_URL__
>
>
Hmm. Not quite - for a start $domain is the domain, so looking it up against a
list of email addresses won't work
(wildlsearch{VARDIR/spool/tmp/mailcleaner/emailaddress.list}). If you can cope
with having emails listed in your file - with *@domain meaning all mail at that
domain then something like:
test_router:
driver = manualroute
transport = remote_smtp
domains = ! +local_domains
route_data = ${lookup{$local_part@$domain}wildlsearch{/etc/exim/jpb15}}
(The hosts_randomize and headers stuff you can keep - it doesn't affect the
routing though so I'll leave them out).
and a file like /etc/exim/jpb15 contains:
*@admin.cam.ac.uk: uasmailhost.internal.admin.cam.ac.uk
[email protected]: mailhost.internal.admin.cam.ac.uk
[email protected]: uasmailhost.internal.admin.cam.ac.uk
*@gmail.com: mailhost.internal.admin.cam.ac.uk
*: defaultmail.admin.cam.ac.uk
I can then do some tests with exim -bt:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
routing [email protected]
--------> test_router router <--------
local_part=jpb15 domain=cam.ac.uk
checking domains
cam.ac.uk in "@ : localhost : localhost.localdomain"? no (end of list)
cam.ac.uk in "! +local_domains"? yes (end of list)
calling test_router router
test_router router called for [email protected]
domain = cam.ac.uk
search_open: wildlsearch "/etc/exim/jpb1"
search_find: file="/etc/exim/jpb1"
key="[email protected]" partial=-1 affix=NULL starflags=0
LRU list:
F/etc/exim/jpb1
End
internal_search_find: file="/etc/exim/jpb1"
type=wildlsearch key="[email protected]"
file lookup required for [email protected]
in /etc/exim/jpb1
[email protected] in "*@admin.cam.ac.uk"? no (end of list)
[email protected] in "[email protected]"? yes (matched "[email protected]")
lookup yielded: mailhost.internal.admin.cam.ac.uk
original list of hosts = "mailhost.internal.admin.cam.ac.uk" options =
expanded list of hosts = "mailhost.internal.admin.cam.ac.uk" options =
set transport remote_smtp
finding IP address for mailhost.internal.admin.cam.ac.uk
exim -d -bt [email protected]
routing [email protected]
--------> test_router router <--------
local_part=jpb15 domain=admin.cam.ac.uk
checking domains
admin.cam.ac.uk in "@ : localhost : localhost.localdomain"? no (end of list)
admin.cam.ac.uk in "! +local_domains"? yes (end of list)
calling test_router router
test_router router called for [email protected]
domain = admin.cam.ac.uk
search_open: wildlsearch "/etc/exim/jpb1"
search_find: file="/etc/exim/jpb1"
key="[email protected]" partial=-1 affix=NULL starflags=0
LRU list:
F/etc/exim/jpb1
End
internal_search_find: file="/etc/exim/jpb1"
type=wildlsearch key="[email protected]"
file lookup required for [email protected]
in /etc/exim/jpb1
[email protected] in "*@admin.cam.ac.uk"? yes (matched "*@admin.cam.ac.uk")
lookup yielded: uasmailhost.internal.admin.cam.ac.uk
original list of hosts = "uasmailhost.internal.admin.cam.ac.uk" options =
expanded list of hosts = "uasmailhost.internal.admin.cam.ac.uk" options =
set transport remote_smtp
exim -d -bt [email protected]
routing [email protected]
--------> test_router router <--------
local_part=foo domain=gmail.com
checking domains
gmail.com in "@ : localhost : localhost.localdomain"? no (end of list)
gmail.com in "! +local_domains"? yes (end of list)
calling test_router router
test_router router called for [email protected]
domain = gmail.com
search_open: wildlsearch "/etc/exim/jpb1"
search_find: file="/etc/exim/jpb1"
key="[email protected]" partial=-1 affix=NULL starflags=0
LRU list:
F/etc/exim/jpb1
End
internal_search_find: file="/etc/exim/jpb1"
type=wildlsearch key="[email protected]"
file lookup required for [email protected]
in /etc/exim/jpb1
[email protected] in "*@admin.cam.ac.uk"? no (end of list)
[email protected] in "[email protected]"? no (end of list)
[email protected] in "[email protected]"? yes (matched "[email protected]")
lookup yielded: uasmailhost.internal.admin.cam.ac.uk
original list of hosts = "uasmailhost.internal.admin.cam.ac.uk" options =
expanded list of hosts = "uasmailhost.internal.admin.cam.ac.uk" options =
set transport remote_smtp
exim -d -bt [email protected]
routing [email protected]
--------> test_router router <--------
local_part=bar domain=gmail.com
checking domains
gmail.com in "@ : localhost : localhost.localdomain"? no (end of list)
gmail.com in "! +local_domains"? yes (end of list)
calling test_router router
test_router router called for [email protected]
domain = gmail.com
search_open: wildlsearch "/etc/exim/jpb1"
search_find: file="/etc/exim/jpb1"
key="[email protected]" partial=-1 affix=NULL starflags=0
LRU list:
F/etc/exim/jpb1
End
internal_search_find: file="/etc/exim/jpb1"
type=wildlsearch key="[email protected]"
file lookup required for [email protected]
in /etc/exim/jpb1
[email protected] in "*@admin.cam.ac.uk"? no (end of list)
[email protected] in "[email protected]"? no (end of list)
[email protected] in "[email protected]"? no (end of list)
[email protected] in "*@gmail.com"? yes (matched "*@gmail.com")
lookup yielded: mailhost.internal.admin.cam.ac.uk
original list of hosts = "mailhost.internal.admin.cam.ac.uk" options =
expanded list of hosts = "mailhost.internal.admin.cam.ac.uk" options =
set transport remote_smtp
exim -d -bt [email protected]
routing [email protected]
--------> test_router router <--------
local_part=someaddress domain=example.com
checking domains
example.com in "@ : localhost : localhost.localdomain"? no (end of list)
example.com in "! +local_domains"? yes (end of list)
calling test_router router
test_router router called for [email protected]
domain = example.com
search_open: wildlsearch "/etc/exim/jpb1"
search_find: file="/etc/exim/jpb1"
key="[email protected]" partial=-1 affix=NULL starflags=0
LRU list:
F/etc/exim/jpb1
End
internal_search_find: file="/etc/exim/jpb1"
type=wildlsearch key="[email protected]"
file lookup required for [email protected]
in /etc/exim/jpb1
[email protected] in "*@admin.cam.ac.uk"? no (end of list)
[email protected] in "[email protected]"? no (end of list)
[email protected] in "[email protected]"? no (end of list)
[email protected] in "*@gmail.com"? no (end of list)
[email protected] in "*"? yes (matched "*")
lookup yielded: defaultmail.admin.cam.ac.uk
original list of hosts = "defaultmail.admin.cam.ac.uk" options =
expanded list of hosts = "defaultmail.admin.cam.ac.uk" options =
set transport remote_smtp
Does that help ?
John
--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/