Install Postfix
Without auth
postconf -e relayhost=target.mailserver
postconf -e myorigin=$HOSTNAME.mydomain
With auth and TLS :
postconf -e relayhost=[target.mailserver]:587
postconf -e myorigin=$HOSTNAME.mydomain
postconf -e smtp_tls_security_level=may
postconf -e smtp_use_tls=yes
postconf -e smtp_sasl_auth_enable=yes
postconf -e smtp_sasl_password_maps=texthash:/etc/postfix/sasl_password
postconf -e smtp_sasl_security_options=
echo "[target.mailserver]:587 username:password" >> /etc/postfix/sasl_password
Sources :