Postfix with single mail adresses – Send mails from your Linux server

This example covers three mail addresses using two different mail providers (provider1/2).

Configure Postfix

  • sudo dpkg-reconfigure postfix
  • Set configuration to “Internet with smart host”

Add the following lines to /etc/postfix/

sender_dependent_relayhost_maps = hash:/etc/postfix/relaymap
smtp_sender_dependent_authentication = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwords
smtp_sasl_security_options = noanonymous
canonical_maps = hash:/etc/postfix/canonical

Configure SMTP relay server from provider

Define the SMTP servers to send mail to. Only one entry for every provider domain is necessary.

Create /etc/postfix/relaymap

Create hash file:

sudo postmap /etc/postfix/relaymap

Configure email adresses sending configuration

Define mail addresses and their passwords to authenticate.

Create /etc/postfix/sasl_passwords

Create hash file:

sudo postmap /etc/postfix/sasl_passwords

Rewrite local addresses to global addresses for sending

Map your local user logins to global mail adresses.

Create /etc/postfix/canonical


Create hash file:

sudo postmap /etc/postfix/canonical

Restart postfix

Leave a comment

Your email address will not be published.