Re: [exim] Equivalent to transport_maps from Postfix in Exim

Inizio della pagina
Delete this message
Reply to this message
Autore: John Burnham
Data:  
To: exim-users@exim.org
Oggetto: Re: [exim] Equivalent to transport_maps from Postfix in Exim
>
> 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
jpb15@???:        mailhost.internal.admin.cam.ac.uk
foo@???:          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 jpb15@???
--------> 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 jpb15@???
domain = cam.ac.uk
search_open: wildlsearch "/etc/exim/jpb1"
search_find: file="/etc/exim/jpb1"
key="jpb15@???" partial=-1 affix=NULL starflags=0
LRU list:
F/etc/exim/jpb1
End
internal_search_find: file="/etc/exim/jpb1"
type=wildlsearch key="jpb15@???"
file lookup required for jpb15@???
in /etc/exim/jpb1
jpb15@??? in "*@admin.cam.ac.uk"? no (end of list)
jpb15@??? in "jpb15@???"? yes (matched "jpb15@???")
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 jpb15@???
routing jpb15@???
--------> 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 jpb15@???
domain = admin.cam.ac.uk
search_open: wildlsearch "/etc/exim/jpb1"
search_find: file="/etc/exim/jpb1"
key="jpb15@???" partial=-1 affix=NULL starflags=0
LRU list:
F/etc/exim/jpb1
End
internal_search_find: file="/etc/exim/jpb1"
type=wildlsearch key="jpb15@???"
file lookup required for jpb15@???
in /etc/exim/jpb1
jpb15@??? 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 foo@???

routing foo@???
--------> 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 foo@???
domain = gmail.com
search_open: wildlsearch "/etc/exim/jpb1"
search_find: file="/etc/exim/jpb1"
key="foo@???" partial=-1 affix=NULL starflags=0
LRU list:
F/etc/exim/jpb1
End
internal_search_find: file="/etc/exim/jpb1"
type=wildlsearch key="foo@???"
file lookup required for foo@???
in /etc/exim/jpb1
foo@??? in "*@admin.cam.ac.uk"? no (end of list)
foo@??? in "jpb15@???"? no (end of list)
foo@??? in "foo@???"? yes (matched "foo@???")
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 bar@???

routing bar@???
--------> 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 bar@???
domain = gmail.com
search_open: wildlsearch "/etc/exim/jpb1"
search_find: file="/etc/exim/jpb1"
key="bar@???" partial=-1 affix=NULL starflags=0
LRU list:
F/etc/exim/jpb1
End
internal_search_find: file="/etc/exim/jpb1"
type=wildlsearch key="bar@???"
file lookup required for bar@???
in /etc/exim/jpb1
bar@??? in "*@admin.cam.ac.uk"? no (end of list)
bar@??? in "jpb15@???"? no (end of list)
bar@??? in "foo@???"? no (end of list)
bar@??? 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 someaddress@???

routing someaddress@???
--------> 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 someaddress@???
domain = example.com
search_open: wildlsearch "/etc/exim/jpb1"
search_find: file="/etc/exim/jpb1"
key="someaddress@???" partial=-1 affix=NULL starflags=0
LRU list:
F/etc/exim/jpb1
End
internal_search_find: file="/etc/exim/jpb1"
type=wildlsearch key="someaddress@???"
file lookup required for someaddress@???
in /etc/exim/jpb1
someaddress@??? in "*@admin.cam.ac.uk"? no (end of list)
someaddress@??? in "jpb15@???"? no (end of list)
someaddress@??? in "foo@???"? no (end of list)
someaddress@??? in "*@gmail.com"? no (end of list)
someaddress@??? 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