-
Notifications
You must be signed in to change notification settings - Fork 9
Email notification
We use Gmail as it can forward your emails to any other address.
However, if you want to install this email engine on another RPi, here are the steps.
$ sudo apt-get install msmtp ca-certificates
Before you can send an email to any address, you must register your app with Google. The Raspberry Pi does not meet all of Google's security requirements. To better protect your Google account from hackers, the Raspberry Pi gets its own unique password. With this password, it can only send emails to Gmail, not open your entire Google account.
First, check if you enabled the 2-Step Verification when you log in to your Google account. Without 2-Step Verification, Google will not generate the needed password.
The next step is to generate the password by giving the Raspberry Pi an appropriate name, here YoloCam. Let the images speak for themselves.
Your password must be entered in the /etc/msmtprc
file. By the way, the used gbxcthxuwxppxoxh
is just an example.
$ sudo nano /etc/msmtprc
account default
host smtp.gmail.com
port 587
logfile /tmp/msmtp.log
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
auth login
user username@gmail.com
password thepassword
from First Last Name
Close with <Ctrl>+<X>, <Y>, <Enter>
.
Now you can test the connection with the next command:
echo -e "Subject: Test Mail\r\n\r\nThis is a test mail" |msmtp --from=default -t johndoe123@his_mail.us
Of course, you have to replace johndoe123@his_mail.us with your own email address.