[exim] Redirect the emails from domain2 to domain1

Top Page
Delete this message
Reply to this message
Author: Quaquaraquà
Date:  
To: dovecot, exim-users
New-Topics: [exim] exim problem with Redirect the emails from domain2 to domain1
Subject: [exim] Redirect the emails from domain2 to domain1
Dear Dovecot and Exim users,

I have a VPS using these two applications. I am transitioning from a
domain_old to a domain_new. I'd like to redirect all the emails from
domain_old to the local mailboxes of users @ domain_new. In exim I've
assumed that it is enough to add domain_old to the list of local domains:

domainlist local_domains = @ : domain_new : domain_old
...
begin routers
...
local_users:
debug_print = "R: local_user for $local_part@$domain"
driver = accept
domains = +local_domains
transport = dovecot_lmtp
cannot_route_message = Unknown user

However in Dovecot I'm checking both the username and the domain to
perform the authentication:
auth_username_format = %Lu
passdb { driver = sql ; }
password_query = SELECT username, domain, password FROM users WHERE
username = '%n' AND domain = '%d'

To have this system to work, I wish some special rule that rewrites the
domain from domain_old to domain_new. But I'm not sure whether this
needs to be done in exim or dovecot and how to add it?

- Quaquaraqua'