Relayhost with multiple domains, one should not use it

Discussion in 'Installation/Configuration' started by Anton Hofstede, May 8, 2025.

  1. Anton Hofstede

    Anton Hofstede New Member

    Hello community,
    Happy user sinds 2018 on ISPconfig, now my first need on help.

    I have multiple maildomains installed in ISPconfig 3.2.12p1, let's call them domain1, domain2, domain3, domain4 and domain5 (in fact there are a 28 of them).
    In system>Server Config > server3> tab mail I have Relayhost/RelayUser/RelayPassword installed.
    The Relayhost is from my VPS provider and makes sure my mail is less likely to be called SPAM. But I have a limit of sending 1000 mails per day. The Problem: Domain5 is going to be for a non-profit organisation (read: no funds) and will be running a campaign where people can sign up for a daily newsletter. I am expecting to send out approx 2500 - 5000 mails per day.

    I want to have Domain5 of the relayhost and send immediatly through the ISPconfig server.

    What I have been trying to do:
    1. Edit /etc/postfix/main.cf
    > smtp_sender_dependent_authentication = yes (already there)
    > relayhost = [hostingprovider]:587 (already there)
    > smtp_sasl_auth_enable = yes (already there)
    > smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd (already there)
    >smtp_sasl_security_options = noanonymous (already there, was empty)
    >smtp_tls_security_level = may (already there, but was dane)

    2. make exceptions:
    > create file: /etc/postfix/transport
    > add line: domain5: (being empty, it should mean it will be send without relay)
    > execute command: postmap /etc/postfix/transport

    3. Edit /etc/postfix/main.cf:
    > transport_maps = hash:/etc/postfix/transport (this has been added to the rest of the transport maps)

    4. Edit /etc/postfix/sasl_passwd:
    > [vps.transip.email]:587 username@hostingprovider:password
    > execute command: postmap /etc/postfix/sasl_passwd

    5. Security commands / restart
    > chown root:root /etc/postfix/sasl_passwd /etc/postfix/transport
    > chmod 600 /etc/postfix/sasl_passwd /etc/postfix/transport
    > systemctl restart postfix

    When doing this, domain5.tld is still using the RelayHost, instead of my own server. What am I doing wrong?

    Hope someone can help me fix this.

    Thanks in advance.
     
  2. pyte

    pyte Well-Known Member HowtoForge Supporter

    Thats the false assumption here. When setting it to empty it will use the postfix defeault transport which still includes the global relayhost set. You have to set it to smtp:, which then tells postfix to use smtp transport with no relayhost and deliver directly to the MX of the destination.
    Code:
    domain5.tld smtp:
    Make sure to postmap the file and reload postfix after changing the config.
     
  3. Anton Hofstede

    Anton Hofstede New Member

    Thank you Pyte. Indeed it was a false assumption. But also with your alteration including smtp: it still keeps sending it over de relayhost. Have you got any other clues for me?
     
  4. pyte

    pyte Well-Known Member HowtoForge Supporter

    Oh i thought that would just work like that. Maybe check the postfix docs and see if there is a value to overwrite default transport
     
  5. pyte

    pyte Well-Known Member HowtoForge Supporter

    I've checked my solution online and it seems like every other thread/docs i can find suggests the same as the solution. Are you sure you set up everything correct?
     
  6. Anton Hofstede

    Anton Hofstede New Member

    /etc/postfix/relayhost_maps@pyte I think I setup everything well, but it just isn't working. All of a sudden also the mail coming in was not being delivered anymore.
    I had to do a backup recovery :-( This feels like a walk of shame...
    I hope you can have a look at it with me.

    Attached is the main.cf.
    I tried the following three options:
    relayhost = vps.transip.email:587
    relayhost = [vps.transip.email]:587
    relayhost =

    And added:
    smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt


    In /etc/postfix/transport I added:

    Code:
    domain1    smtp:[vps.transip.email]:587
    domain2    smtp:[vps.transip.email]:587
    domain5    smtp:localhost
    
    In /etc/postfix/sasl_passwd:
    Code:
    [vps.transip.email]:587    [email protected]:password
    In the DNS of the domains I added
    _x-transip-mail-auth.domain.nl. IN TXT "v=transip-mail-auth"

    I also tried the following options
    Added: /etc/postfix/relayhost_maps to main.cf
    And make the file /etc/postfix/relayhost_maps with:
    Code:
    @domain1    [vps.transip.email]:587
    @domain2 [vps.transip.email]:587
    @domain5   :
    Can you or somone else see what is going wrong? And why I don't receive any mails?

    Many many thanks for helping me out.
     

    Attached Files:

Share This Page