exim4 redirect mail sent to *@domain1.example.com to *@domain2.example.com

Posted by nightcoder on Server Fault See other posts from Server Fault or by nightcoder
Published on 2012-03-20T20:17:33Z Indexed on 2012/03/21 11:32 UTC
Read the original article Hit count: 429

Filed under:
|
|
|
|

Current situation:
We have a VPS that hosts a website example.org. Exim is configured to work as a smarthost. All emails sent through exim are successfully relayed to another mail server (that is working on example.com).

Goal:
To forward mail sent to *@example.org to *@example.com, i.e. change the recipient's address from *@example.org to *@example.com.

Problem:
If I send email to address *@example.org, then it seems exim doesn't change the address, it still relays the message to another mail server but recipient is still *@example.org. Maybe the redirect is not applied for some reason.

Configuration and logs:

/etc/exim4/update-exim4.conf.conf:

dc_eximconfig_configtype='smarthost'
dc_other_hostnames=''
dc_local_interfaces=''
dc_readhost='example.org'
dc_relay_domains='example.org'
dc_minimaldns='false'
dc_relay_nets='0.0.0.0/32'
dc_smarthost='example.com::26'
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname='true'
dc_mailname_in_oh='true'
dc_localdelivery='maildir_home'

/etc/exim4/conf.d/router/999_exim4-config_redirect (created by me):

 domain_redirect:  
     debug_print = "R: forward for $local_part@$domain"  
     driver = redirect  
     domains = example.org
     data = [email protected]

(for now data is set to a specific address for simplicity and testing)

exim log when sending email to [email protected] (should be redirected to [email protected]):

2012-03-20 19:40:07 1SA4ud-0005Dw-7k <= [email protected] U=www-data P=local S=657
2012-03-20 19:40:08 1SA4ud-0005Dw-7k => [email protected] R=smarthost T=remote_smtp_smarthost H=domain2.com [184.172.146.66] X=TLS1.0:RSA_AES_256_CBC_SHA1:32 DN="C=US,2.5.4.17=#13053737303932,ST=TX,L=Houston,STREET=Suite 400,STREET=11251 Northwest Freeway,O=HostGator.com,OU=HostGator.com,OU=Comodo PremiumSSL Wildcard,CN=*.hostgator.com"
2012-03-20 19:40:08 1SA4ud-0005Dw-7k Completed

So, the address is not changed :(

Please help! I'm trying to make it work for half a day already :(

© Server Fault or respective owner

Related posts about email

Related posts about emailserver