External SMTP relay server for the domain

  1. Edit /etc/postfix/main.cf

  2. Add these lines:
    smtp_sasl_auth_enable = yes
    smtp_sasl_security_options = noanonymous
    smtp_sasl_password_maps = hash:/etc/postfix/saslpasswd
    smtp_always_send_ehlo = yes
    relayhost = smtp.domain.tld

Change the smtp.domain.tld with your providers SMTP and add port if the port SMTP is different. Eg. relayhost = smtp.your_domain.tld:port

  1. Create a file saslpasswd in /etc/postix. Eg. /etc/postfix/saslpasswd

  2. Add your username and password in saslpasswd in following format.

    smtp.domain.tld yourlogin:yourpassword

  3. Hash saslpasswd with following command.

    $ postmap /etc/postfix/saslpasswd

  4. Restart postfix.

    $ service postfix restart

That’s it

Test it and see the postfix logs for the relay traces.

Note: When the Yunohost gets updated you will have to configure /etc/postfix/main.cf again as Yunohost update will overwrite this file.

You can even relay from your friends Yunohost server too.

5 Likes