alias domains not working

Fongaboo
2010-12-16
2013-01-23
  • Fongaboo
    Fongaboo
    2010-12-16

    I've looked at a few  past posts on alias domains but none of them seem to be clearing things up for me. I am wondering if I am completely misunderstanding what alias domains do…

    I've got DOMAIN1.TLD and DOMAIN2.TLD. I've made DOMAIN2.TLD an Alias Domain of DOMAIN1.TLD.

    DOMAIN1.TLD has one mailbox 'test@DOMAIN1.TLD' and one catch-all alias of '*@DOMAIN1.TLD' that forwards to a Gmail account.

    If I send a test email to 'test@DOMAIN1.TLD' and 'other@DOMAIN1.TLD', I get the email in the mailbox (on my server) and in my Gmail respectively…

    If I send a test email to 'test@DOMAIN2.TLD' and 'other@DOMAIN2.TLD' I get the following failure:

    <other@DOMAIN2.TLD>: host postfix.server.tld said: 550 5.1.1
        <other@DOMAIN2.TLD>: Recipient address rejected: User unknown in virtual
        mailbox table (in reply to RCPT TO command)

    <test@DOMAIN2.TLD>: host postfix.server.tld  said: 550 5.1.1
        <test@DOMAIN2.TLD>: Recipient address rejected: User unknown in virtual
        mailbox table (in reply to RCPT TO command)

    I thought the whole purpose of an alias domain is it should transpose it from <something>@DOMAIN2.TLD to <something>@DOMAIN1.TLD. Or do I have it all wrong?

     
  • Simon Hobson
    Simon Hobson
    2010-12-16

    Have you correctly setup the Postfix-MySQL integration ? There are significant differences to previous versions (if you've upgraded) and you needs a second set of queries/recipient maps to deal with alias domains.

     
  • alexanderc
    alexanderc
    2011-01-31

    simonhobson,

    Could you please elaborate. I also have a virtual alias domain aliased to a virtual domain. Emails to the virtual domain work fine (emailaddress@virtualdomain.com), but emails to the virtual alias domain do not (emailaddress@virtualaliasdomain.com). The exact message is:

    Remote host said: 550 5.1.1 <emailaddress@virtualaliasdomain.com>: Recipient address rejected: User unknown in virtual mailbox table

    Kind Regards,

    Alex

    BELOW IS SOME CONFIGURATION INFORMATION TO HELP.

    postfix: version 2.7.2

    postfix:/etc/postfix # cat main.cf

    daemon_directory = /usr/lib/postfix

    ############################################################
    # Start MySQL from postfixwiki.org
    ############################################################
    virtual_alias_domains = mysql:/etc/postfix/mysql_virtual_alias_domains_maps.cf
    virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
    virtual_uid_maps = static:303
    virtual_gid_maps = static:303
    virtual_minimum_uid = 303
    virtual_mailbox_base = /home/vmail
    #virtual_mailbox_base = /srv/maildirs
    virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
    virtual_mailbox_limit = 51200000
    virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
    virtual_transport = virtual
    # Additional for quota support
    virtual_create_maildirsize = yes
    virtual_mailbox_extended = yes
    virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf
    virtual_mailbox_limit_override = yes
    virtual_maildir_limit_message = Sorry, the user's maildir has overdrawn his diskspace quota, please try again later.
    virtual_overquota_bounce = yes
    relay_domains = $mydestination, mysql:/etc/postfix/mysql_relay_domains_maps.cf
    ############################################################
    # End MySQL from postfixwiki.org
    ############################################################

    postfix:/etc/postfix # cat mysql_virtual_alias_domains_maps.cf
    user = postfix
    password = mysqlpassword
    hosts = mysqlserver_ip_address
    dbname = postfix
    table = alias_domain
    select_field = concat('@', target_domain)
    where_field = concat('@', alias_domain)
    additional_conditions = and active = '1'

    postfix:/etc/postfix # cat mysql_virtual_alias_maps.cf

    user = postfix
    password = mysqlpassword
    hosts = mysqlserver_ip_address
    dbname = postfix
    table = alias
    select_field = goto
    where_field = address

    postfix:/etc/postfix # cat mysql_virtual_domains_maps.cf

    user = postfix
    password = mysqlpassword
    hosts = mysqlserver_ip_address
    dbname = postfix
    table = domain
    select_field = domain
    where_field = domain
    additional_conditions = and backupmx = '0' and active = '1'

    postfix:/etc/postfix # cat mysql_virtual_mailbox_maps.cf

    user = postfix
    password = mysqlpassword
    hosts = mysqlserver_ip_address
    dbname = postfix
    table = mailbox
    select_field = maildir
    where_field = username
    additional_conditions = and active = '1'

    postfix:/etc/postfix # cat mysql_virtual_mailbox_limit_maps.cf

    user = postfix
    password = mysqlpassword
    hosts = mysqlserver_ip_address
    dbname = postfix
    table = mailbox
    select_field = quota
    where_field = username
    additional_conditions = and active = '1'

    postfix:/etc/postfix # cat mysql_relay_domains_maps.cf
    user = postfix
    password = mysqlpassword
    hosts = mysqlserver_ip_address
    dbname = postfix
    table = domain
    select_field = domain
    where_field = domain
    additional_conditions = and backupmx = '1'

     
  • # Start MySQL from postfixwiki.org

    That's your problem ;-) - your configuration does not include alias domains, therefore they obviously can't work.

    It might sound selfish, but please, please always use POSTFIX_CONF.TXT in the PostfixAdmin documentation as base for your config. Many of the HOWTOs around the web (including postfixwiki) are outdated or incomplete.