[exim] exim problem with Redirect the emails from domain2 to…

Top Page
Delete this message
Reply to this message
Author: Steffen Kaiser
Date:  
To: Quaquaraquà
CC: exim-users, dovecot
Old-Topics: [exim] Redirect the emails from domain2 to domain1
Subject: [exim] exim problem with Redirect the emails from domain2 to domain1
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, 7 Nov 2016, Quaquaraquà wrote:

>
> 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:


I cannot help you with exim

> 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?


If exim would map domain_old to domain and your users will use domain
always, that would be the easiest way. More consitent, IMHO.

Otherwise (if you want to support users to login with old domains, for
instance):

1) add another column with domain_old and use AND (domain = '%d' OR
domain_old = '%d)

domain_old would contain the old domain, domain the new one.

2) if you think you get more domains per user over the time, add another
table and use JOIN or sub-SELECT.

- --
Steffen Kaiser
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEVAwUBWCSTH3z1H7kL/d9rAQJNFgf/fjfpv/v9tyU8E3QXzGeEtyb1V84t3yut
2ML1oS07soZPhs+Kbh15HqDi3a+0geLElpnMbvXV7dHqYE2az11QgFKf2krV9dVO
Y/SN22Pjwn9S6T0HGpGqk+aY62FG8uN6deXZeimKnmMRXQ0b1iswtSVb1KuTml9s
jMx7OPPexxiS6keKJrFU0LsSPQjqSDc7OmtuMEbWWpJL6ANYb3pYCJl9BugUHDp/
fenmJ2Ft8e8FjSpP/kXkYlgEVhs/Xw8rSz5I2XoQ+T68IICqCe+RwrazNJ8X6N3W
1bEsX9OYG4VTNasjJCLGaJ7i1ktfI5Bu1kvv1U4oeAlrd7acNpP7oA==
=7dPg
-----END PGP SIGNATURE-----