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
[email protected] will be forwarded to [email protected]. Now
when I send a mail from [email protected] to [email protected], it
gets forwarded to [email protected]. And the from address is '
[email protected]'. 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.
-- 
## 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/

Reply via email to