sudo apt install postfix
sudo nano /etc/postfix/main.cf
mydomain = example.com
myorigin = /etc/mailname
relayhost = [smtp.example.com]:587
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
sudo tail -f /var/log/mail.log
sudo systemctl restart postfix
sudo apt install mailutils -y
echo "Ceci est un email de test" | mail -s "Sujet de l'email de test" mon@email.com
sudo apt install libsasl2-modules
sudo nano /etc/postfix/main.cf
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_security_level = may
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
sudo nano /etc/postfix/sasl_passwd
[smtp.example.com]:587 username:password
sudo postmap /etc/postfix/sasl_passwd
sudo chown root:root /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
sudo chmod 600 /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
sudo systemctl restart postfix