Запуск:
sudo apt-get install ssmtp
sudo -H gedit /etc/ssmtp/ssmtp.conf
Здесь должно быть добавлено следующее:
# The user that gets all the mails (UID < 1000, usually the admin)
root=yourusernameofgmail@gmail.com
# The mail server (where the mail is sent to), both port 465 or 587 should be acceptable
# See also https://support.google.com/mail/answer/78799
mailhub=smtp.gmail.com:587
# The address where the mail appears to come from for user authentication.
rewriteDomain=gmail.com
# Use SSL/TLS before starting negotiation
UseTLS=Yes
UseSTARTTLS=Yes
# Username/Password
AuthUser=yourusernameofgmail
AuthPass=yourGmailPassowrd
AuthMethod=LOGIN
# Email 'From header's can override the default domain?
FromLineOverride=yes
Запустить :
sudo -H gedit /etc/ssmtp/revaliases
Войдите туда:
root:yourusernameofgmail@gmail.com:smtp.gmail.com:587
Включите «менее безопасные приложения» в Gmail: https://support.google.com/accounts/answer/6010255?hl=ru&!d6]
Включить «менее безопасные приложения» в Gmail:
echo "Body of mail is abc" | mail -s "Subject is xyz" "someusername@gmail.com"`