I have set up a motion detection camera on my raspberry pi zero w, and it's able to record videos and save pictures and upload them to dropbox but not sending email notifications on_event_start and this is how I defined my on_event_start (on_event_start echo "email body" | mail -s "subject" [email protected]). I'm using ssmtp and mailutils for email packages. Although I'm able to send emails through terminal. This is how my ssmtp.conf looks like:
root=postmaster
mailhub=smtp.gmail.com:587
hostname=raspberrypi
[email protected]
AuthPass=***********
FromLineOverride=YES
UseSTARTTLS=YES
UseTLS=YES
RewriteDomain=gmail.com
And this is how my revaliases looks like:
root:myEmail@gmail:mail.google.com:587
This is the error that is logged onto the mail.log when motion is detected by the camera.
Unable to connect to "mail.google.com" port 587.
Cannot open mail.google.com:587
Is there something that i'm missing or is there any other way to send an email notification when motion is detected? Someone please help me on this.
Your revaliases file should be pointing to smtp.gmail.com instead of mail.gmail.com. Please try with following in your revaliases file:
root:[email protected]:smtp.gmail.com:587