Or how to configure postfix to use  alias_domain table found in postfixadmin schema

Follow the closest howto (lacks domain aliases description) to setup the latest version of postfiadmin and make it work with your postfix.

Then add two other maps so it will look something like:

virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf, mysql:/etc/postfix/mysql_virtual_alias_alias_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf, mysql:/etc/postfix/mysql_virtual_mailbox_alias_maps.cf

you need these two to make postfix search for mailboxes or aliases in aliased domains, the corresponding queries are:

mysql:/etc/postfix/mysql_virtual_alias_alias_maps.cf :
query = SELECT goto FROM alias,alias_domain
  WHERE alias_domain.alias_domain = '%d'
  AND alias.address=concat('%u', '@', alias_domain.target_domain)
  AND alias.active = 1
mysql:/etc/postfix/mysql_virtual_mailbox_alias_maps.cf :
query = SELECT maildir FROM mailbox, alias_domain
  WHERE alias_domain.alias_domain = '%d'
  AND mailbox.username=concat('%u', '@', alias_domain.target_domain )
  AND mailbox.active = 1

Nothing special, rather for myself to remember

14 Thoughts on “alias_domain postfixadmin postfix configuration

  1. Great! Exactly what I was looking for. Many thanx.

  2. Mark Kecko on October 4, 2009 at 5:42 am said:

    Thanks a million for posting this,it should definitely be documented on the postfixadmin site.

  3. Andy Loewe on June 30, 2010 at 12:45 pm said:

    ‘Tried to use standard postfix notation from mysql_virtual_mailbox_maps.cf but failed. Use the query as above and you’re on your way. Many thanks for your posting. Submit it to the postfixadmin site please!

  4. Perfect solution! Just what I searched for. Simple and works 🙂 Thanx!

  5. No No on May 16, 2011 at 4:03 am said:

    It may be nothing special to you, but to the rest of us…  Although I understood what’s missing, I could not synthesize the SQL & postfix main.cf –I was lamely trying to SELECT the alias_domains themselves so that postfix could do the translation, using its virtual_alias_domains parameter.) So thank you very much for rescuing me!

  6. No No on May 16, 2011 at 4:03 am said:

    It may be nothing special to you, but to the rest of us…  Although I understood what’s missing, I could not synthesize the SQL & postfix main.cf –I was lamely trying to SELECT the alias_domains themselves so that postfix could do the translation, using its virtual_alias_domains parameter.) So thank you very much for rescuing me!

  7. Marcel on June 21, 2011 at 4:27 pm said:

    thank you a lot for those queries, helped me a lot!
    Unfortunately i think the domain_alias active field is not taken into consideration yet in those queries.

    • Marcel on June 21, 2011 at 4:46 pm said:

      think that would just work:
      query = SELECT goto FROM alias,alias_domain WHERE alias_domain.alias_domain = ‘%d’ AND alias.address=concat(‘%u’, ‘@’, alias_domain.target_domain) AND alias.active = 1 AND alias_domain.active = 1

  8. Marcel on June 21, 2011 at 4:27 pm said:

    thank you a lot for those queries, helped me a lot!
    Unfortunately i think the domain_alias active field is not taken into consideration yet in those queries.

    • Marcel on June 21, 2011 at 4:46 pm said:

      think that would just work:
      query = SELECT goto FROM alias,alias_domain WHERE alias_domain.alias_domain = ‘%d’ AND alias.address=concat(‘%u’, ‘@’, alias_domain.target_domain) AND alias.active = 1 AND alias_domain.active = 1

  9. Thank you, this guide really helped.

  10. Thank you, this guide really helped.

  11. Pingback: Installation de PostfixAdmin

  12. Thanks for this :), it works perfectly but I found that I needed to add the database connection details as well to each alias file.

    So it the scripts become:

    user = root
    password = passwhatever
    hosts = 127.0.0.1
    dbname = mail
    query = ...

Leave a Reply

Your email address will not be published. Required fields are marked *

Post Navigation