sudo apt-get update
sudo apt-get install ssmtp
sudo apt-get install mailutils
sudo nano /etc/ssmtp/ssmtp.conf
root=pp@gmail.com mailhub=smtp.gmail.com:587 hostname=localhost RewriteDomain=gmail.com UseSTARTTLS=YES UseTLS=YES AuthUser=pp@gmail.com AuthPass=something # remember to use a password without symbols
Checking to see mail works:
echo “Hello, World” | mail -s “My email check” user@gmail.com
Check log:
tail -f /var/log/syslog
Configuration of Zoneminder:
- Go to Options->Email
- Make sure OPT_EMAIL is checked (zmfilter.pl checks to see if this option is checked. If not, it will not send emails)
- In the EMAIL_ADDRESS field enter the email address you want to get these alarms
- EMAIL_SUBJECT and EMAIL_BODY are self explanatory
- Make sure NEW_MAIL_MODULES is checked (VERY IMPORTANT)
- EMAIL_HOST: put in localhost
- FROM_EMAIL: I put in root@localhost
- URL: If you have configured your ZM to be accessible using a public DNS (maybe using no-ip DDNS or others), you should put in the web address here. It will be something like http://yourzoneminderurl.domain:port/zm (unless you have changed it). When you get alarms, ZM provides a link and uses this url as a base. You can put in a LAN IP here too, but then you will only be able to access it from your LAN
- SSMTP_Mail: check this.
- SSMTP_Path: Depends on your distribution. Try $ whereis ssmtp
- in body, add:
- Here are the first and the the highest score image in the alarm: %EI1% %EIM%
Change the Full Name of the user www-data to send emails with a correct name:
chfn -f “ZoneMinderAlarm” www-data
Create a filter, add background and email details:
alarm frames greather than or equal to 1