On 09/29/2015 03:41 AM, Voytek wrote: > I have Postfix/Dovecot/postfixadmin/MySQL with several virtual mailbox > domains > > one of the domains is like aname.com.au, the user also now has aname.com, > and, would like to 'mirror' most of the addresses to be u...@aname.com, > THOUGH, some are to remain as us...@aname.com.au > > so, both u...@aname.com as well as u...@aname.com.au should be one user > > what's the best/proper way to do so ? > > I think there is an option in postfixadmin to "Mirror addresses of one of > your domains to another." , is that the way to do this?
The option in postfixadmin simply adds the domain alias to a table that you designate, you still need to tell postfix how to use that table. The way that I would do it, given that you're using mysql, is to alter your virtual_alias_maps query so that it's a UNION between the two tables. This is what I have for postgresql, you'll need to tweak it a bit to work for mysql and for your specific tables: query = (SELECT goto FROM alias WHERE address='%s' AND active) UNION (SELECT goto FROM (SELECT '%u@' || target_domain goto FROM alias_domain WHERE alias_domain = '%d' AND active) AS a WHERE (goto IN (SELECT username FROM mailbox WHERE active) OR goto IN (SELECT address FROM alias WHERE active))) Peter