need help parsing email per subdomain

mlecho
2014-06-18
2014-06-18
  • mlecho

    mlecho - 2014-06-18

    i'd like to route all mail for two sub-domains to a script depending on which subdomain receives the mail.

    messages.mydomain.com
    stagingmessages.mydomain.com

    Everything works for messages.mydomain.com, but not for stagingmeassages. i am getting a little confused on how to set up my main.cf and the maps for subdomain parsing. it's very likely that in all my research i've added perhaps too much to my main.cf

    main.cf

    myhostname = mydomain.com
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = /etc/mailname
    mydestination = $myhostname, /etc/postfix/domains 
    relayhost = 
    mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    
    virtual_maps = hash:/etc/postfix/addresses
    alias_maps = hash:/etc/aliases
    inet_protocols = all
    

    aliases

    rails_mailer_staging:   "|/var/www/vhosts/admin.mydomain.com/htdocs/bin/mail_handler_staging.rb"
    rails_mailer:       "|/var/www/vhosts/mydomain.com/htdocs/bin/mail_handler_production.rb"
    

    domains

    messages.mydomain.com
    stagingmessages.mydomain.com
    

    addresses

    messages.mydomian.com       DOMAIN
    @messages.mydomian.com      rails_mailer
    
    stagingmessages.mydomian.com    DOMAIN
    @stagingmessages.mydomian.com   rails_mailer_staging
    
     
  • Simon Hobson

    Simon Hobson - 2014-06-18

    This is not a general Postfix help forum - this is for the separate package Postfix Admin which configures/maintains virtual domains & mailboxes using Postfix (plus MySQL, optionally maildrop, and Courier or Dovecot).
    For Postfix help you should head over to postfix.org and check out the Postfix mailing lists.

    Looking at your config, the two subdomains are almost identical except for the script called - perhaps if you tried changing the script for staging messages to match messages and see what happens - that would determine whether it's a "postfix issue" or a "script issue". I know it's the wrong script you'd be calling, but the test is to see if it gets called or if you still have the problem.
    Also, you might try turning on some debugging - I know how to turn on peer debugging, never needed to do it for "the other end" of the queue so can't help there.

     

Log in to post a comment.