Page 1 of 1

Setting up e-mail sending?

Posted: Tue Jan 13, 2009 3:03 pm
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

Posted: Wed Jan 14, 2009 1:51 am
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.

Posted: Wed Jan 14, 2009 2:27 am
by haus
Your ZM_EMAIL_HOST and ZM_FROM_EMAIL options are reversed.

Posted: Wed Jan 14, 2009 4:25 am
by c0mputerking
sorry i missed that bit

Posted: Wed Jan 14, 2009 7:49 am
by chrilleman
Doh, it was really that easy, sorry guys... Should´nt work that late on the night :)

Thanks!

Posted: Wed Jan 14, 2009 10:01 am
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?

Posted: Wed Jan 14, 2009 6:28 pm
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.

Posted: Thu Jan 15, 2009 7:48 am
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

Posted: Thu Jan 15, 2009 11:14 pm
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.

Posted: Mon Jan 19, 2009 1:41 am
by cordel
Also be aware that most mail servers block smtp from dynamic IP's .

Posted: Mon Jan 19, 2009 10:33 am
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.