Setting Up

Postfix

Configure Postfix to relay outgoing mail through the gateway.

Configure Postfix to relay outgoing mail through the gateway as a smart host, rather than delivering directly.

  1. In /etc/postfix/main.cf, set:
   relayhost = [smtp.adlerwacht.com]:587
   smtp_sasl_auth_enable = yes
   smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
   smtp_sasl_security_options = noanonymous
   smtp_tls_security_level = encrypt

Use port 465 with smtp_tls_wrappermode = yes instead if you need implicit TLS rather than STARTTLS.

  1. Create /etc/postfix/sasl_passwd with your gateway account's credentials:
   [smtp.adlerwacht.com]:587 you@yourcompany.com:your-mailbox-password
  1. Secure and hash the credentials file, then reload Postfix:
   chmod 600 /etc/postfix/sasl_passwd
   postmap /etc/postfix/sasl_passwd
   systemctl reload postfix
  1. Send a test message from the server to confirm it now routes through the gateway.
This makes the gateway your server's relay for all outgoing mail. If you only want specific domains or senders routed through it, use Postfix's sender_dependent_relayhost_maps instead of the global relayhost setting.