Selective smtp relay to smarthost based on FROM/ORGIN domain

Discussion in 'qmail' started by m1b1, Jan 2, 2014.

  1. m1b1

    m1b1 New Email

    Joined:
    Jan 2, 2014
    Messages:
    2
    Likes Received:
    0
    i have a qmail server which hosts multiple domains (domain1, domain2, domain3, etc.)..i want to route outbound emails from a single domain to a smarthost (external smtp) server...basically i want sender_dependent_relayhost_maps functionality for qmail

    Google support for smtp/qmail relay says this:


    To set up a smarthost for Qmail:

    Edit (or create) the file /var/qmail/control/smtproutes and append the following line:

    :smtp-relay.gmail.com:25

    If you have certain internal domains whose traffic should not be routed to Google, you will want to add specific routing to the appropriate mail server to the /var/qmail/control/smtproutes file using the following syntax:

    <InternalDomain>:<ServerForInternalDomain>


    But what i want is email from domain2.com to be routed to the smarthost (e.g. google smtp) and all other domains (domain1, domain3, etc.) to be delivered normally.

    What is the normal/default setting for "<ServerForInternalDomain>" (i.e, use my current setup) and what is the correct syntax for InternalDomain and ServerForInternalDomain....

    My research indicates that InternalDomain followed by a server is for forwarding SELECTIVE TO recipients not SELECTIVE FROM (domain) recipients filtering

    Google implies that every other "internal" domain needs to be routed manually, while another thread implies that the /var/qmail/control/smtproutes file is hierarchical, but again it's still unclear whether this is TO or FROM filtering--i want FROM)
     


  2. popowich

    popowich EQ Forum Admin Staff Member

    Joined:
    Aug 12, 2008
    Messages:
    8,994
    Likes Received:
    120
    Hi m1b1,

    None of the above is for routing based on From:

    All of the above, and everything qmail smtproutes in general, is for routing based on destination.

    Are there a lot of domains? Is this a single exception? The easiest way to accomplish this, without adding patches (if they exist) is to run 2 instances of qmail on the server. They'd share the primary outgoing IP, but you could have multiple interfaces, a default, and one for the exception, to allow you to have a qmail for the general ail users, and a second that has a smtproutes file configured to route mail to the other relay. At that point you might as well be giving those users the other relay to use though.

    If you do take this path, you can create a /var/qmail and /var/qmail2, each will have their own configurations, and local wrappers too such as a the /path/to/qmail/bin/sendmail that could be called from any local scripting as needed.
     

  3. m1b1

    m1b1 New Email

    Joined:
    Jan 2, 2014
    Messages:
    2
    Likes Received:
    0
    hi,

    thanks for your help.

    there may be 2-3 domains in the future, so i don't *really* want to run that many instances of qmail..is there no way to do the postfix equivalent to sender_dependent_relayhost_maps in qmail?

    thanks again for your reply and help.
     
  4. popowich

    popowich EQ Forum Admin Staff Member

    Joined:
    Aug 12, 2008
    Messages:
    8,994
    Likes Received:
    120

Want to reply or ask your own question?

It only takes a minute to sign up (and it's free!). Click the orange sign up button to choose a username and then you can ask your own questions on the forum.
Loading...