[Exim] Rewriting External Addresses but not Internal Address…

Top Page
Delete this message
Reply to this message
Author: Peter A. Cole
Date:  
To: exim-users
Subject: [Exim] Rewriting External Addresses but not Internal Addresses
Hi all,

I've just set up my mail server of sorts here which is running Debian Sarge
with Exim4, Fetchmail, and Procmail.

I'm trying to set it up so I can send internal mail without going via my ISP
and external mail with address rewriting going via my ISP.

The internal domain is starpoint.local and the ISP domain is bigpond.com.

I found this configuration below for rewriting external emails only, and I
have created the file /etc/email-addresses-intranet, but external mail is
not being adjusted accordingly.

I'm obviously doing something wrong and my lack of understanding of Exim is
probably not helping.

As it turns out, the file I added this to is
/etc/exim4/conf.d/30_exim4-config_remote_smtp which I assume is the same
file they mean here but with a different name due to the newer version.

Any tips at all?

Thanks,

Pete


I found the solution :
1) Don't declare anything any /etc/exim4/email-addresses (or else,
addresses are always rewritten)
2) Instead, use a custom file : /etc/exim4/email-addresses-intranet
3) Append the following lines to 30_exim4-base_remote_smtp
in /etc/exim4/conf.d/transport

--
# translate outgoing email adresses to fully qualified adresses, as
# ruled by the file /etc/exim4/email-adresses-intranet
  headers_rewrite = *@intranet
${lookup{$1}lsearch{CONFDIR/email-addresses-intranet}{$value}fail} : \
                    *@router
${lookup{$1}lsearch{CONFDIR/email-addresses-intranet}{$value}fail} : \
                    *@localhost
${lookup{$1}lsearch{CONFDIR/email-addresses-intranet}{$value}fail} : \
                    *@router.intranet
${lookup{$1}lsearch{CONFDIR/email-addresses-intranet}{$value}fail}
  return_path = ${if
match{$return_path}{\N^([^@]+)@(intranet|router|localhost|router.intranet)$\
N}{${lookup{$1}lsearch{CONFDIR/email-addresses-intranet}{$value}fail}}fail}