Use smarthost for some domains

Discussion in 'Tips/Tricks/Mods' started by iqpascal, Apr 13, 2018.

  1. iqpascal

    iqpascal New Member HowtoForge Supporter

    Hi,
    I am a noob on Postfix as I have used Exim for like 20 years or so. Because mail delivery to gmail.com and hotmail.com and other domains is sometimes sucky (either mail gets send to spam or gets accepted and goes nowhere) I use smtp2go for some domain names on Exim. But how can I do this with Postfix? There is a howto on smtp2go site for all mail (https://www.smtp2go.com/setupguide/postfix/) but not for some domain names.

    I read about rerouting some domains by using /etc/postfix/transport but I do not get how this works for smtp2go (as you need to use login credentials for this service)
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Transports are probably the right way to go. You can add transports in ISPconfig. See Mail > Email routing
     
  3. iqpascal

    iqpascal New Member HowtoForge Supporter

    Thank you for pointing me in the right direction.

    So I did this:
    Added @gmail.com to the relay recipients
    Added gmail.com to the Email routing with destination mail.smtp2go.com:2525

    And changed main.cf with:

    Code:
    smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = hash:/etc/postfix/relay_passwords
    smtp_sasl_security_options = noanonymous
    smtp_tls_security_level = may
    Contents of relay_passwords is:

    Code:
    mail.smtp2go.com username:password
    postmap /etc/postfix/relay_password

    And restart postfix

    And that seems to work. It uses login credentials for mail.smt2pgo.com and routes all but gmail.com to the MX in the DNS. And gmail goes to mail.smtp2go.com.

    Perhaps this is tutorial worthy if there are no mistakes in my config?
     
    ahrasis and till like this.

Share This Page