How to configure Postfix relayhost (smarthost) to send eMail using an external smptd

www.lau‮t‬turi.com
How to configure Postfix relayhost (smarthost) to send eMail using an external smptd

To configure Postfix to send emails using an external SMTP server (also known as a "smarthost"), you will need to perform the following steps:

  1. Edit the Postfix main configuration file, /etc/postfix/main.cf, and add the following line, replacing <smarthost> with the hostname or IP address of the external SMTP server:
relayhost = <smarthost>:587
  1. If the external SMTP server requires authentication, you will also need to add the following lines to the configuration file, replacing <username> and <password> with your login credentials:
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:<username>:<password>
  1. Save the changes to the configuration file and exit the text editor.

  2. Restart Postfix to apply the changes:

systemctl restart postfix
  1. Test the configuration by sending a test email using the sendmail command:
echo "Test message" | sendmail <recipient>
Created Time:2017-10-28 21:39:00  Author:lautturi