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

  • gollum

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

  • Mark Kecko

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

  • Andy Loewe

    ‘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!

  • http://maciejewski.org cancer

    Perfect solution! Just what I searched for. Simple and works :) Thanx!

  • No No

    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!

  • No No

    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!

  • Marcel

    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

      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

  • Marcel

    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

      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

  • http://openid-provider.appspot.com/zunkree zunkree

    Thank you, this guide really helped.

  • http://openid-provider.appspot.com/zunkree zunkree

    Thank you, this guide really helped.

  • Pingback: Installation de PostfixAdmin()

  • http://cowandsheep.co.za Jonathan

    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 = ...

Post Navigation