Results 1 to 3 of 3

Thread: Relay host per domain and avatar

  1. #1
    Join Date
    Mar 2014
    Lyon, FRANCE
    Rep Power

    Default Relay host per domain and avatar

    Hi there,

    I configured postfix to relay emails sent from a specific mail domain to an external SMTP relay (MailJet).

    Emails are relayed successfully. However they are relayed only when I send email from an account created on this specific domain.

    We have 2 mail domains with a shared folder from an account created on this specific mail domain. This shared folder is shared with some other accounts created on the second mail domain (on the same ZCS server).

    From these other accounts, we reply to emails from this shared folder with an avatar corresponding to the mail domain relayed.

    The issue is emails sent from these other accounts are not relayed to the external SMTP relay.

    After some diagnostics, it seems than postfix (in my configuration) does not read the "from address" to relay through an external relay but only the "received: from address". By consequently, emails sent from avatars are not relayed via this external SMTP relay.

    Is there a way to tell to postfix to relay emails sent from some specifics avatars?

    To simplify,
    2 mail domains : domain1 and domain2
    mails sent from domain1 are relayed via an external SMTP relay
    1 account account@domain1 with a shared folder folder1
    multiple accounts on domain2 with access to the shared folder folder1
    accounts from domain2 need to reply to emails received on folder1 and have to use an avatar account@domain1

    How to relay emails sent with avatar account@domain1 via the external SMTP relay?

    My current postfix configuration look at this :
    /opt/zimbra/postfix/conf/ :
    smtp_sasl_password_maps = hash:/opt/zimbra/postfix/conf/relay_password
    sender_dependent_relayhost_maps = hash:/opt/zimbra/postfix/conf/sender_relay
    smtp_sender_dependent_authentication = yes
    smtp_sasl_auth_enable = yes
    smtpd_tls_security_level = may
    smtpd_tls_key_file = /opt/zimbra/conf/smtpd.key

    /opt/zimbra/postfix/conf/sender_relay :
    @domain1 []:587

    /opt/zimbra/postfix/conf/relay_password :
    @domain1 APIkey:SecretKey

    Does someone can help me?


  2. #2
    Join Date
    Mar 2014
    Lyon, FRANCE
    Rep Power


    I am working on it for 1 week now without fix or workaround.

    I am currently using ZCS 6.0.8. Does someone know if the latest version of ZCS (8.0.6) replace the original sender by the "From address" of the avatar/persona in the email header or does it keep the original sender like with ZCS 6.0.8?

    The main issue is that, the original sender is kept in the email header (the "received: from address") and by consequently I can't relay my emails sent from a persona through an external SMTP relay because Postfix does not read it. It only reads the original sender in the email header to send it to an external SMTP relay host it if it has to be relayed.

    Any help would be greatly appreciated.


  3. #3
    Join Date
    Mar 2014
    Lyon, FRANCE
    Rep Power


    Hi there,

    I have found a workaround by configuring postfix by another way (via header_checks).

    Here is the instruction for who needs to use an external SMTP relay when sending emails from a specific persona/avatar :

    As zimbra user
    (I use mailjet as SMTP relay, so replace it the SMTP relay you want to use)

    Create a file to store your header based rules
    $ touch /opt/zimbra/postfix/conf/header_checks.pcre

    Edit it
    $ vi /opt/zimbra/postfix/conf/header_checks.pcre
    /^From:.*your_sender*/ FILTER smtp:[]:587
    (replace your_sender by the sender name (used as persona) or the sender email address and the smtp by the one you want to use)
    (you need to use PCRE syntax (Perl Compatible Regular Expressions)

    Add it to you postifix configuration file
    $ postconf -e header_checks=pcre:/opt/zimbra/postifx/conf/header_checks.pcre

    Add your authentication information :
    $ vi /opt/zimbra/postfix/conf/relay_password
    []:587 APIkey:SecretKey
    (adjust with your SMTP and your APIkey and SecretKey (or your username and password)

    Create/update the lookup table :
    $ postmap hash:/opt/zimbra/postfix/conf/relay_password

    If you haven't added it yet in your postifix file :
    $ postconf -e smtp_sasl_password_maps =hash:/opt/zimbra/postfix/conf/relay_password

    Do not reload the postfix configuration. In my case the line "header_checks = pcre:/opt/zimbra/conf/header_checks.pcre" is replace by the original one.

    Have a look to your /var/log/zimbra.log file and send some emails to check if your rule is taken in account.

Similar Threads

  1. SMTP relay Host
    By jayanathm in forum Administrators
    Replies: 3
    Last Post: 10-14-2012, 06:36 AM
  2. mta relay host
    By kdrikc in forum Installation
    Replies: 1
    Last Post: 07-22-2009, 04:24 AM
  3. Allow relay for a specific host
    By cryptogram in forum Administrators
    Replies: 5
    Last Post: 04-21-2007, 04:30 PM
  4. zimbra relay and host
    By florinatu in forum Administrators
    Replies: 1
    Last Post: 12-27-2005, 11:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts