Re: [exim] Check for a particular header in exim router

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: soumya tr
Fecha:  
A: John Burnham
Cc: exim-users@exim.org
Asunto: Re: [exim] Check for a particular header in exim router
Hi,

Thanks a lot for the tips.

But I am not reaching my goal. Let me explain in brief about my setup and
my ultimate goal:

* Server uses exim as mail server to which relaying is set [thus all the
mails will be relayed via another server, infact a postfix server].

* I have set forwarders in the server. Thus all mails to
forwarder@??? will be forwarded to receipient@???. Now
when I send a mail from sender@??? to forwarder@???, it
gets forwarded to receipient@???. And the from address is '
sender@???'. This is causing issues at the relay server [as some
checks are in place at relay server]

* So I was thinking of sending all the forwarder mails via server itself
instead of relaying.

To achieve this, what I did was like added a header in the router which
handles the forwarder part:

-------------------
virtual_aliases_nostar:
driver = redirect
allow_defer
allow_fail
require_files = "+/etc/valiases/$domain"
data = ${lookup{$local_part@$domain}lsearch{/etc/valiases/$domain}}
headers_add = X-Mail-Forwarder: ${primary_hostname}
file_transport = address_file
group = mail
pipe_transport = virtual_address_pipe
retry_use_local_part
unseen
-------------------

And then added a router that checks the header and sends the mail
accordingly, as shown below:

-------------------
# Lookup host router for forwarder mails
forwarder_route:
    driver = dnslookup
    condition = "${if def:header_X-Mail-Forwarder{$h_X-Mail-Forwarder}}"
    ignore_target_hosts = +loopback : 64.94.110.0/24
    headers_add = "${perl{mailtrapheaders}}"
    transport = remote_smtp



# Lookup host router for remote smtp
smart_route:
    driver = manualroute
    ignore_target_hosts = +loopback : 64.94.110.0/24
    headers_add = "${perl{mailtrapheaders}}"
    transport = remote_smtp
    route_list = !+local_domains X.X.X.X:Y.Y.Y.Y randomize


-------------------

But all the mails are getting relayed via relay server, irrespective of
whether its forwarder or normal.

Am I wrong any where? Please assist.

Thanks in advance.