I use this method on my Raspberry Pi 3 devices:
Google Account Settings
- Log in to your gmail account
- Go to: Settings → Accounts and Import → Other Google Account Settings
- Go to: Personal Information and Privacy → Account Overview
- : →
SSMTP
sudo apt-get install ssmtp
conf
sudo mv /etc/ssmtp/ssmtp.conf /etc/ssmtp/ssmtp.conf.bak
conf ( vi )
sudo vi /etc/ssmtp/ssmtp.conf
root=your_account@gmail.com
mailhub=smtp.gmail.com:587
FromLineOverride=YES
AuthUser=your_account@gmail.com
AuthPass=your_password
UseSTARTTLS=YES
UseTLS=YES
conf
sudo groupadd ssmtp
sudo chown :ssmtp /etc/ssmtp/ssmtp.conf
, , " "... ssmtp : sudo find/-name "ssmtp"
sudo chown :ssmtp /usr/sbin/ssmtp
sudo chmod 640 /etc/ssmtp/ssmtp.conf
sudo chmod g+s /usr/sbin/ssmtp
( )
echo "This is a test" | ssmtp recipient.address@some_domain.com
printf "To: recipient.address@some_domain.com\nFrom: RaspberryPi3\nSubject: Testing send mail from Raspberry\n\nThis is test. Best Regards!\n" | ssmtp -t
test.txt
:
To: recipient.address@some_domain.com
From: your_account@gmail.com
Subject: Testing send mail from Raspberry
This is test mail (body)
Best Regards!
ssmtp recipient.address@some_domain.com < test.txt
:)