Re: Managing Mail between two domains
- Wire James wrote:
> Hi Allcreate table mailbox (user ..., domain, ....) ...
> I have situation where a client has a current domain dxx.co.ug and
> would like to change to dxx.go.ug. I set up their mail server with
> Postfix+Mysql and all users are in a database. However I dont want to
> create two independent user databases for the different domains.
> What I want is automatic transfer of mail if it comes to say
> admin@... to go to admin@... and the same should happen to
> all the other users. Any pointer on a resource that can be helpful in
> achieving this? Remember I am using postfix integrated with Mysql.
create table alias_domain (alias ..., target ....) ....
insert into mailbox values ('wjames', 'dxx.go.ug');
insert into alias_domain values ('dxx.co.ug', 'dxx.go.ug');
virtual_alias_maps = ..... mysql:/etc/postfix/per-domain-alias.cf ...
in the latter,
query = select concat(user, '@', domain) from alias_domain, mailbox
where %d = alias and domain = target
The idea is to only return a result if the "target" address exists
(otherwise, you break recipient validation).
then check with 'postmap -q':
# postmap -q wjames@... mysql:/etc/postfix/mailbox.cf
# postmap -q wjames@... mysql:/etc/postfix/per-domain-alias.cf