[Exim] Exim rewrite of local usernames but only for non loca…

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Felix Erkinger
Ημερομηνία:  
Προς: debian-user
Υ/ο: exim-users
Αντικείμενο: [Exim] Exim rewrite of local usernames but only for non local Recipients
I found out a working solution, for one of my problems,
on how to rewrite email-addresses with exim for outgoing mail,
but only if the Receipent isnt local.

Here is the snipet, if sombody else is searching...
(Change "saturn" to the name of your local machine)
(Uses the standard debian /etc/email-addresses file)
(Beware that if you use something like saturn.mydomain to escape the dots
with \\)

Felix


to insert somewhere in the Transports Configuration
####################################################

int_smtp:
driver = smtp

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



to change in the Routers Configuration
#####################################################

lookuphost:
driver = lookuphost
#transport = remote_smtp
# Select int_smtp transport if domain ends with saturn
transport = ${if match{$domain}{saturn\$}{int_smtp}{ext_smtp}}