Need help with mail event triggers

Forum for questions and support relating to the 1.34.x releases only.
Post Reply
ghostwolf59
Posts: 19
Joined: Sat Apr 11, 2020 12:46 pm

Need help with mail event triggers

Post by ghostwolf59 »

Hi,
I just installed zm (v1.34.9) where I hooked up a Reolink RLC-410-5MP bullet camera.
Got it to work to the point of not being able to receive emails on triggered events.
This is driving me nuts atm - would have been nice if the web gui had a feature that could verify the email without being forced to trigger an event.
Similar to for instance Nextcloud have it setup - quicker and less mucking around.

Anyways, I setup a mockup trigger event and configured the email sendout under the Options -> Email settings.
Installed postfix and have no issues sending a command line test email, but whatever I do I dont seem to be able to get the email sent out as part of triggered event.

This is basically how I set up postfix within my FreeNAS jail *freenas v 11.3*

<code>
#############################################################
# postfix Manual configuration for email

## SASL Options
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/usr/local/etc/postfix/sasl_passwd

## TLS Options
smtp_use_tls = yes
smtp_tls_security_level = encrypt
tls_random_source = dev:/dev/urandom

## Relay host
relayhost = [smtp.iinet.net.au]:587
#
disable_vrfy_command = yes
inet_interfaces = loopback-only
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
smtpd_helo_required = yes

#############################################################

18. postfix -c /usr/local/etc/postfix set-permissions

19. $ newaliases
$ postalias /etc/aliases


20. edit /usr/local/etc/postfix/sasl_passwd
[smtp.iinet.net.au]:587 #####@iinet.net.au:mailPsw


21. postmap /usr/local/etc/postfix/sasl_passwd
22. chmod 0600 /usr/local/etc/postfix/sasl_passwd
23. chown root:wheel /usr/local/etc/postfix/sasl_passwd
24. echo "Test Email Contents" | mail -s "Postfix Test Email" myTESTemail@iinet.net.au
25. check log: edit /var/log/maillog

</code>


On the zm web interface I opted for
OPT_EMAIL checked
EMAIL_ADDRESS (valid email recipient address)
OPT_MESSAGE checked
MESSAGE_ADDRESS (valid email recipient address)
NEW_MAIL_MODULES *checked and unchecked - tried both option but nothing sent)
EMAIL_HOST set to localhost
FROM_EMAIL set to dummy zm@iinet.net.au address

What am I doing wrong????

This is driving me insane :(

Anyone that can assist me with this - please....
ghostwolf59
Posts: 19
Joined: Sat Apr 11, 2020 12:46 pm

Re: Need help with mail event triggers

Post by ghostwolf59 »

Is this a common issue or a damn difficult issue to resolve with zm?

Really confused with 26 views so far but not a single comment, suggestion .... or anything :shock:

If someone have a solution that differs from the path I went down, I would appreciate that just as well - don't really care what transport the mail is using - I simply went down the postfix path as a result of not being able to get other methods to work.

IF(!) this is a known problem with no solution to the problem I would be just as pleased being told that.
User avatar
burger
Posts: 390
Joined: Mon May 11, 2020 4:32 pm

Re: Need help with mail event triggers

Post by burger »

https://wiki.zoneminder.com/SMS_Notifications

Please have patience with posts. You can bump if your post falls through the cracks, but it had only been a day.

Easiest way to setup email is with SSMTP / Debian. See the above link for troubleshooting info and setup.
fastest way to test streams:
ffmpeg -i rtsp://<user>:<pass>@<ipaddress>:554/path ./output.mp4 (if terminal only)
ffplay rtsp://<user>:<pass>@<ipaddress>:554/path (gui)
find paths on ispydb or in zm hcl

If you are new to security software, read:
https://wiki.zoneminder.com/Dummies_Guide
ghostwolf59
Posts: 19
Joined: Sat Apr 11, 2020 12:46 pm

Re: Need help with mail event triggers

Post by ghostwolf59 »

Thanks for the heads up.

Been tinkering going down the ssmtp path, but thought a fully working postfix should work with zm. After all its working perfectly from the command line.

Im not sure if theres something else I missed - docu points towards trigger an event, but then again, Ive come across statements suggesting that I need to set up filtering via the Audit Events Report - the whole concept is weird when it comes to this.

All I want is for an email is sent to me if a zone is triggered by a camera.
Triggers and records, but nothing sent to prompt me to the fact that a zone have been breached/triggered.
User avatar
burger
Posts: 390
Joined: Mon May 11, 2020 4:32 pm

Re: Need help with mail event triggers

Post by burger »

As I mentioned, easiest way is to use debian. Using freenas, or freebsd, or slackware, or anything else means you
are off the beaten path, and it's essentially 'experts only' territory. You can use a lot of different dists with ZM, but debian is the easiest. Fedora would probably be next.

So I would advise you use that, and then configure ssmtp. I've written
a full guide at https://wiki.zoneminder.com/SMS_Notifications

Other emails should work, though I have of yet not configured them. If you are having trouble with email, postfix or otherwise, the best thing to do is to manually step through the email process as described above in the wiki link. If you can manually send emails via command line, then you can compare the postfix output with the manual emails and find out what is not working.

As an example, ssmtp won't work with AUTH PLAIN, or one of the MD5 options. The best way I've found to discover this is by manually connecting to the email server and seeing what it is expecting, then comparing with the other email (ssmtp in this case).
fastest way to test streams:
ffmpeg -i rtsp://<user>:<pass>@<ipaddress>:554/path ./output.mp4 (if terminal only)
ffplay rtsp://<user>:<pass>@<ipaddress>:554/path (gui)
find paths on ispydb or in zm hcl

If you are new to security software, read:
https://wiki.zoneminder.com/Dummies_Guide
ghostwolf59
Posts: 19
Joined: Sat Apr 11, 2020 12:46 pm

Re: Need help with mail event triggers

Post by ghostwolf59 »

Hi,
Thanks for posting this info - in part resolved the issue for me.
Also noticed this in the logs "Can't locate MIME/Entity.pm in @INC" resulting in cron job failing to start.
Turned out that I had to install MIME::Entity perl module that never got installed by default.
Resolution to MIME issue:
1. ssh into jail
2. type in
perl -MCPAN -eshell <enter>
3. Accept default <Yes> <enter>
4. at the prompt type:
install MIME::Entity
# done!

As for email, I now successfully manage to use postfix and once I checked the "Email details of all matches" on the Filters and checked "Run filter in background" it sends out the email.

Next ??? is to limit number of false positives i.e tweak sensitivity so Im not flooded by emails
Post Reply