This is a general set up for postfix. This can also apply for plesk linux running postfix.
To begin some files in the postfix config directory must be created. This varies based on the install, but often is simply /etc/postfix which will be used in this documentation.
Create a file /etc/postfix/header_custom and add the following line:
/^Received: (.*Authenticated sender:)([^)]*)(.*)/i PREPEND X-Sender-id: $2
Save the file. This will be used to include an authorized header X-Sender-id on emails.
Create a password file called /etc/postfix/sasl_passwd
Add in the smtp server and the smtpusername:password in the format of
relay.mailbaby.net username:password
The login information will show in the client portal.
Set the permissons and create the postmap hash with the command below.
chown root:root /etc/postfix/sasl_passwd; chmod 600 /etc/postfix/sasl_passwd; postmap hash:/etc/postfix/sasl_passwd
Edit /etc/postfix/main.cf and add to the bottom of the config file
relayhost = relay.mailbaby.net:25
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtpd_sasl_authenticated_header = yes
smtp_tls_security_level = encrypt
smtp_header_checks = regexp:/etc/postfix/header_custom
Save the file. Finally check the config with
postconf
and restart postfix.