Re: [exim] Redirect the emails from domain2 to domain1

Pàgina inicial
Delete this message
Reply to this message
Autor: Quaquaraquà
Data:  
A: Exim Users
Assumpte: Re: [exim] Redirect the emails from domain2 to domain1
Hi Mike,
good point, I've modified the sql query with something like:
... WHERE username = '%n' AND domain = CASE '%d' WHEN 'old_domain' THEN
'new_domain' ELSE '%d' END
Now also the old domain is accepted. Only for speculation's sake, I
thought as there are two header fileds in the email, Delivered-To and
To, just rewriting the former in exim would have worked flawlessly for
dovecot and would not have hidden the actual destination address. I
haven't tried this approach though.

Thanks,
Quaquaraqua'

On 07/11/16 10:10, Mike Brudenell wrote:
> Greetings -
>
> I guess you can do it in either…
>
>     - In Exim it's easy: you would rewrite the address(es) from the old
>     domain to the new one. Read the chapter on rewriting in the *Exim
>     Specification*.
>     - In Dovecot I guess you'd just modify the *password_query* construct to
>     see if the *domain* was either the old or new domain.

>
> Something to think about is the effect of secretly rewriting the old domain
> to new domain in addresses. If you do then, depending which address(es) you
> rewrite, recipients might not be able to tell whether someone sent to the
> old domain name or the new one, so can't tell the sender to start using
> their new address instead.
>
> It depends on whether you plan to run both domains indefinitely, or want to
> phase the old one out eventually.
>
> Cheers,
> Mike B-)
>
> On 7 November 2016 at 00:35, Quaquaraquà <nuquaquaraqua@???> wrote:
>
>> 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'
>>
>>
>> --
>> ## List details at https://lists.exim.org/mailman/listinfo/exim-users
>> ## Exim details at http://www.exim.org/
>> ## Please use the Wiki with this list - http://wiki.exim.org/
>
>
>