Re: [Exim] Domain name rewriting from local senders to non-l…

Top Pagina
Delete this message
Reply to this message
Auteur: Felix Erkinger
Datum:  
Aan: Exim-users
Onderwerp: Re: [Exim] Domain name rewriting from local senders to non-local recipients in Exim 3.36
On Fri, Mar 07, 2003 at 04:40:43PM -0000, Martyn Hill wrote:
> Where and how should I configure the rewriting of the domain from local
> senders to non-local recipients (or any recipient, for that matter)?


I found two possiblities for that:

1.) a global header rewrite
2.) a router definition which chooses a different transport
    according to the domain of the receiver, and rewrite
    the sender address in the transport section


if the first one works for you, (in my case every mail got rewritten, even
mail destinated to other local users) fine, if not, use the second one,
which is a little bit more complicated, but was the only possibility
for me to get it working. (anyway, no idea if this is a good solution)

Both of them use the file /etc/email-addresses for their rewriting data,
and kistl.dom as the local domain.

good times,
    Felix.



>>> sample /etc/email-addresses

# This is /etc/email-addresses. It is part of the exim package
#
# This file contains email addresses to use for outgoing mail. Any local
# part not in here will be qualified by the system domain as normal.
#
# It should contain lines of the form:
#
user: someone@???
otheruser: someoneelse@???


1.) is a snippet from the debian version of exim,
which looks up /etc/email-addresses for every user ending with @kistl.dom
(which is my local domain), and rewrites it according to /etc/email-addresses

>>> to put into exim.conf into the rewrite configuration section

# This rewriting rule is particularly useful for dialup users who
# don't have their own domain, but could be useful for anyone.
# It looks up the real address of all local users in a file

*@kistl.dom    ${lookup{$1}lsearch{/etc/email-addresses}{$value}fail} frFs



2.) split smtp transport into local and external smtp delivery,
and rewrite external deliveries the same way as 1.)

>>> to put and exchange with the current into exim.conf
>>> into the routers configuration section

lookuphost:
driver = lookuphost
#transport = remote_smtp
# new transport depends if domain is local or external
transport = ${if match{$domain}{kistl\\.dom\$}{int_smtp}{ext_smtp}}

>>> to put into exim.conf into the transports configuration section

int_smtp:
   driver = smtp
ext_smtp:
   driver = smtp
   # Rewrite email-addresses for external mail based on /etc/email-addresses
   headers_rewrite = *@kistl.dom \
      ${lookup{$1}lsearch{/etc/email-addresses}{$value}fail}
   return_path = ${if match{$return_path}{^([^@]+)@kistl\\.dom\$}\
     {${lookup{$1}lsearch{/etc/email-addresses}{$value}fail}}fail}