To get started install postfix:
apt install postfix
in /etc/postfix/main.cf you need to add a relayhost and enable sasl authentication:
inet_protocols = all
relayhost = [emailserver.tld]:submission
smtp_sasl_auth_enable=yes
smtp_sasl_password_maps=hash:/etc/postfix/smtp-passwords
smtp_sasl_security_options=
smtpd_tls_auth_only = yes
smtp_tls_security_level = may
now create /etc/postfix/smtp-passwords that holds your email credentials:
[emailserver.tld]:submission your-username:email-password
almost done. you have to create a hashmap and reload postfix:
postmap /etc/postfix/smtp-passwords
systemctl reload postfix