Setting up e-mail sending?

Support and queries relating to all previous versions of ZoneMinder
Locked
chrilleman
Posts: 10
Joined: Tue Oct 07, 2008 12:38 pm

Setting up e-mail sending?

Post by chrilleman »

Hello,

I must do something wrong.. I want the ZM to send me emails when there are some alert. I have setup everything under the email:
Image

I have done one simple event that will send everything to my e-mail just for test, but I dont recive any mails, can i check somewhere if the mail is sent or if something else is wrong? Any options that i have missed?

Image

Really greatful for help, can´t find out what I am doing wrong..

Thanks
//Christian
c0mputerking
Posts: 190
Joined: Tue Sep 16, 2008 5:22 am

Post by c0mputerking »

Your options in Zoneminder look ok have you checked your mail log?? is anything reaching it?? Also what disto or cd or package are you using?? i had problems with not having the correct perl modules installed took a bit to figure it out with the help of this forum of course.
haus
Posts: 213
Joined: Thu Oct 11, 2007 5:10 am

Post by haus »

Your ZM_EMAIL_HOST and ZM_FROM_EMAIL options are reversed.
c0mputerking
Posts: 190
Joined: Tue Sep 16, 2008 5:22 am

Post by c0mputerking »

sorry i missed that bit
chrilleman
Posts: 10
Joined: Tue Oct 07, 2008 12:38 pm

Post by chrilleman »

Doh, it was really that easy, sorry guys... Should´nt work that late on the night :)

Thanks!
chrilleman
Posts: 10
Joined: Tue Oct 07, 2008 12:38 pm

Post by chrilleman »

Just one more question, how do I make an filter that only sends the new events since the last mail was sent? Evertime the e-mail filter is running it would send all the events? Or am I understanding it wrong?
haus
Posts: 213
Joined: Thu Oct 11, 2007 5:10 am

Post by haus »

Each event will only be sent once (there's a flag in the database for "emailed"). But, as far as I can tell there's no reliable way to limit alerts/emails by time (for example, I can't record 50 events per hour but only send one SMS or email every 5 minutes) without using an external piece of code.

That said, there are examples of code like that either in here or in the wiki. I know I've seen it, but I can never find it when I actually sit down and think about implementing something like that.

Another option would be to specify a larger interval between filter runs, and then bake that time delay into the filter. So for example, set ZM_FILTER_EXECUTE_INTERVAL to 300 (run once every 5 minutes), and then limit your filter results to the first 1 result only and put a time restriction that the event must have occurred in the last 5 minutes. But this means your alerts will be delayed by up to 5 minutes (presumably you could have concurrent filters running on the same events, so that you could upload the events to a remote location and *not* limit to the first result).

I have always wanted to write something that sends an SMS based on a filter but only if another SMS hasn't been sent in the last N minutes. Partly cloudy days are hell with respect to my ZM box, because the indoor alarms are always going off and sending me alerts. Limiting the frequency of SMS messages (or emails) could be done with some relatively minor modification to zmfilter.pl. If I get around to it I'm sure I'll post the code here as an effort to give back to the community that has been so helpful.
chrilleman
Posts: 10
Joined: Tue Oct 07, 2008 12:38 pm

Post by chrilleman »

Thank you for the answer :)

I was´nt really sure if the database set some kind of flag that the event has been e-mailed. Very nice to know.

The limit is not really a problem for me, I got my own smtp server offsite so all i need is that procedure to work.

Regards

Christian
c0mputerking
Posts: 190
Joined: Tue Sep 16, 2008 5:22 am

Post by c0mputerking »

In case this helps you most isp's block outgoing packets on port 25 i had to use 325 and a redirect at the server firewall end of things to get postfix to work. If you have this issue i might be able to help hopefully you are at a location where port blocking is not an issue.
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

Also be aware that most mail servers block smtp from dynamic IP's .
chrilleman
Posts: 10
Joined: Tue Oct 07, 2008 12:38 pm

Post by chrilleman »

Thanks for all help, it works really good know, contacted my ISP and they opened trafic from my ip range to their smtp gateway.
Locked