How I set up Email Alerts on Zoneminder on Debian 12
First you will have to install MSMTP ( If ssmtp , sendmail available , please uninstall completely )
Open the terminal and run
sudo apt install msmtp
Note: before making below symlink , make sure that there is no sendmail file in /usr/bin
sudo ln -s /usr/bin/msmtp /usr/sbin/sendmailWhen zmfilter.pl searchs for /usr/sbin/sendmail , it redirects to msmtp which is the main executable file at /usr/bin/
Now you will have to create a configuration file called msmtprc which contains email hosts ,ports ,certificates ,email details etc at the directory /etc/sudo nano /etc/msmtprc
When the empty file is opened, enter the following scripts
# Set default values for all following accounts.
defaults
auth on
tls
on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile ~/.msmtp.log
# Gmail
account gmail
host
smtp.gmail.com
port 587
from
your gmail address
user
your gmail address
password your gmail "app"
password
# Set a default account
account default : gmail
Exit and save the file
Note: for info on Gmail App passwords see https://support.google.com/mail/answer/185833?hl=enTo add group www-data to the file
sudo chown root:www-data /etc/msmtprc
Now you can try a test mail on the terminal
echo "Subject: msmtp test" | msmtp -v an.em@il.address(replace an.em@il.address with a real address)
Now go to Options/Email on the ZM-Console and set the following:-To set up filters you now enter the "Email Body" with what used to be entered in the Options Email "Message_Body"I used:-
ZM alarm detected - %EL% secs, %EF%/%EFA% frames, t%EST%/m%ESM%/a%ESA%
score.
Attach (first) event image with the highest score : %EIM%
Path to the event stream : %EPS%
Path to your ZoneMinder console : %ZP%