Relay Recipients and mail route (postfix transport) not working

Discussion in 'General' started by mikerogers, Apr 7, 2015.

  1. mikerogers

    mikerogers Member

    I am trying to route one email address to a specific custom postfix transport ( php script ).
    Server info: Ispconfig 3.0.5.4P5, Postfix 2.6.6-6.el6_5, Dovecot 2.0.9-8.el6_6.4
    I added the email to "Global Filters / Relay recipients". Under "Email routing", I add the same email in the domain field and choose "Custom" as the type.
    I have a custom transport in "/etc/postfix/master.cf":
    Code:
    emailparsef     unix    -       n       n       -       1       pipe
            flags=FR        user=web141     argv=/var/www/clients/client1/web141/web/lead-control-panel/emailparse/emailparseg.php
            ${nexthop} ${user}
    
    As a test from gmail, I send an email to that email address and always get this back:
    Code:
    Delivery to the following recipient failed permanently:
    
         [email protected]
    
    Technical details of permanent failure:
    Google tried to deliver your message, but it was rejected by the server for the recipient domain extremeleadprogram.com by nnn.serversdomain.com. [n.nn.nn.nn].
    
    The error that the other server returned was:
    550 5.1.1 <[email protected]>: Recipient address rejected: User unknown in virtual mailbox table
    
    As a test, I ran this command: "sendmail -bv [email protected]" and this is what I get back:
    Code:
    This is the mail system at host nnn.serversdomain.com.
    
    Enclosed is the mail delivery report that you requested.
    
                       The mail system
    
    <[email protected]>: mail transport unavailable
    
    Final-Recipient: rfc822; [email protected]
    Action: undeliverable
    Status: 4.3.0
    Diagnostic-Code: X-Postfix; mail transport unavailable
    
    I have been banging my head for 2 days trying different methods of getting one email address to pipe to a script. Dovecot pigeonhole pipe looked promising, but I had no luck with it. This seems like a no brainer, but I'm missing something.
    Any help would be greatly appreciated, thank you in advance.
    Mike Rogers
     
  2. mikerogers

    mikerogers Member

    Meant to post the results of "postconf -n" in case that would help:
    Code:
    alias_database = hash:/etc/aliases
    alias_maps = hash:/etc/aliases
    broken_sasl_auth_clients = yes
    command_directory = /usr/sbin
    config_directory = /etc/postfix
    daemon_directory = /usr/libexec/postfix
    data_directory = /var/lib/postfix
    debug_peer_level = 2
    html_directory = no
    in_flow_delay = 10s
    inet_interfaces = all
    inet_protocols = ipv4
    local_destination_concurrency_limit = 1
    mail_owner = postfix
    mailbox_size_limit = 0
    mailq_path = /usr/bin/mailq.postfix
    manpage_directory = /usr/share/man
    message_size_limit = 0
    mydestination = cs1.tristateweb.com, localhost, localhost.localdomain
    myhostname = cs1.tristateweb.com
    mynetworks = 127.0.0.0/8 [::1]/128
    newaliases_path = /usr/bin/newaliases.postfix
    proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
    queue_directory = /var/spool/postfix
    readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
    relay_domains = mysql:/etc/postfix/mysql-virtual_relaydomains.cf
    relay_recipient_maps = mysql:/etc/postfix/mysql-virtual_relayrecipientmaps.cf
    relayhost =
    sample_directory = /usr/share/doc/postfix-2.6.6/samples
    sendmail_path = /usr/sbin/sendmail.postfix
    setgid_group = postdrop
    smtp_destination_concurrency_limit = 2
    smtp_destination_rate_delay = 1s
    smtpd_client_message_rate_limit = 100
    smtpd_client_restrictions = check_client_access mysql:/etc/postfix/mysql-virtual_client.cf
    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_recipient_access mysql:/etc/postfix/mysql-virtual_recipient.cf, reject_unauth_destination
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_authenticated_header = yes
    smtpd_sasl_path = private/auth
    smtpd_sasl_type = dovecot
    smtpd_sender_restrictions = check_sender_access mysql:/etc/postfix/mysql-virtual_sender.cf
    smtpd_tls_cert_file = /etc/postfix/smtpd.cert
    smtpd_tls_key_file = /etc/postfix/smtpd.key
    smtpd_tls_security_level = may
    smtpd_use_tls = yes
    transport_maps = hash:/var/lib/mailman/data/transport-mailman, proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
    unknown_local_recipient_reject_code = 550
    virtual_alias_domains =
    virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, proxy:mysql:/etc/postfix/mysql-virtual_email2email.cf
    virtual_gid_maps = static:5000
    virtual_mailbox_base = /var/vmail
    virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
    virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
    virtual_transport = dovecot
    virtual_uid_maps = static:5000
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    You wrote that you want to redirect just one email address? So you have other adresses configured in that domain? To use the transport, the domain may not be added as email domain on the server.
     
  4. mikerogers

    mikerogers Member

    I figured it was something simple, thank you.
    Next question, is it ok if this is a sub-domain?
    I added a sub-domain: ep.mydomain.com.
    I did NOT add that sub-domain as an email domain. I then added an email address "[email protected]" to the Relay recipients and added a route for it.
    Now I get "Relay access denied" when I send an email to that email address from gmail. When a do a sendmail -bv to it, I still get: " mail transport unavailable"
    I'm thinking this might not work even for a sub-domain, but I don't have another domain that gets no emails to test it with?
     
  5. mikerogers

    mikerogers Member

    I have made a bit of progress. I also found an old domain to test not using a sub-domain. That doesn't seem to matter.
    In the "Email routing" I unchecked the "No mx lookup" box and now when I do a "sendmail -bv" command, the report I get back looks promising: "delivery via emailparsef: delivers to command: /var/www/clients/client1/web141/web/lead-control-panel/emailparse/emailparseg.php".

    However, when I send a test email to it via gmail, I still get: "Relay access denied"...
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Ddi you change the entry in relay recipients to the new address too? I use the transports and relay recipients on several servers to filter mails in front of a exchange servers and this works fine.
     
  7. mikerogers

    mikerogers Member

    Yes, I have added the entry in relay recipients:
    [​IMG]
    Here is my email route:
    [​IMG]
    What am I missing?
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    and none of these two domains is added as email domian in ispconfig and none of them is the hostname of the server or listed anywhere in postfix main.cf ?
     
  9. mikerogers

    mikerogers Member

    No, here is a screenshot of me searching the email domain:
    [​IMG]
    (I'm only trying to use the @ep.extremeleadprogram.com sub-domain. The other was a domain I tried that isn't listed in ISPconfig anywhere).
    Here's a screenshot of the "hostname" command on the server:
    [​IMG]
    Here's a screenshot of me searching the "main.cf" file for "extremelead":
    [​IMG]
     
  10. mikerogers

    mikerogers Member

    I'm trying to think of anything else that could be causing this... I did upgrade this server to Ispconfig 3.0.5.4p5 a few months ago and when I did, I had to copy my old main.cf file for some reason (can't remember) to the main.cf.
    I know previously I had commented out the two lines for amavis.
    Is there a way to just reconfigure postfix. I know I can run the update script for ispconfig, but will that allow me to just re-configure postfix?
     
  11. mikerogers

    mikerogers Member

    Running "ispconfig_update.sh" didn't help, just got: "There are no updates available for ISPConfig 3.0.5.4p".
     
  12. mikerogers

    mikerogers Member

    I found out how to do the manual update, so I ran that:
    Code:
    cd /tmp
    wget http://www.ispconfig.org/downloads/ISPConfig-3-stable.tar.gz
    tar xvfz ISPConfig-3-stable.tar.gz
    cd ispconfig3_install/install
    php -q update.php
    This rebuilt the config file... I have double checked and still get the same error:
    Code:
    Technical details of permanent failure:
    Google tried to deliver your message, but it was rejected by the server for the recipient domain ep.extremeleadprogram.com by cs1.tristateweb.com. [8.38.76.97].
    
    The error that the other server returned was:
    554 5.7.1 <[email protected]>: Relay access denied
    Anyone have any clues? I need to get this working ASAP and am willing to pay for support...
     
  13. mikerogers

    mikerogers Member

    Ok, I have made some further progress (even though it's still not super helpful to me, but it may make sense to you).
    If I email from the server command line: "mail [email protected]", The email routes properly to my script ( I get a message as I should from the script ).
    However, if I send an email to "[email protected]" from any external webmail like gmail, yahoo or hotmail, I get a reply bounce of "Relay access denied".
    It's almost as if it's trying to send an email "FROM" the web based mail address, IE "[email protected]" so the system won't let it relay. This would make sense if I was trying to send email from that email through the system, but I'm not... I'm sending an email to an email on the system....
     
  14. mikerogers

    mikerogers Member

    Quick followup on this
    I have found a work around for this that will get me by...
    I leave the "Relay recipients" and "Email route" as is and then create a forwarding email address "[email protected]" --> "[email protected]".
    Apparently this makes the system think the localhost is doing the relaying... I know it's not proper, but it's working for me and I only plan on doing this with one email address ever so I guess I'm ok with it, thanks.
     
    till likes this.

Share This Page