postfix smart relay
Configure postfix to relay all email via a selected server
Edit your /etc/postfix/main.cf file if you have a line starting with
smtp_tls_security_level = (something)
insert a # at the begining of that line. ThenĀ add the following lines to the end of the file
# Enable auth smtp_sasl_auth_enable = yes # Set username and password smtp_sasl_password_maps = static:YOUR-SMTP-USER-NAME-HERE:YOUR-SMTP-SERVER-PASSWORD-HERE smtp_sasl_security_options = noanonymous # Turn on tls encryption smtp_tls_security_level = encrypt header_size_limit = 4096000 # Set external SMTP relay host here IP or hostname accepted along with a port number. relayhost = [YOUR-SMTP-SERVER-IP-HERE]:587
then
systemctl restart postfix
Tested on Fedora 40