Can't send events by email

Forum for questions and support relating to the 1.24.x releases only.
Locked
zumbarotinus
Posts: 10
Joined: Fri Dec 23, 2011 11:17 pm

Can't send events by email

Post by zumbarotinus »

Hello!

I have a working 1.24.2 zoneminder setup on a debian machine. And I have setup postfix to relay emails via gmail, which is working fine via command line, e.g. mails -s "Test" ...

However, I can't get zoneminder to send me event details via email. My options configuration are like the following:

Name
OPT_EMAIL yes
EMAIL_ADDRESS myemail@gmail.com
EMAIL_SUBJECT ZoneMinder: Alarm
EMAIL_BODY Hello, An alarm has been detected on your installation of the ZoneMinder.
OPT_MESSAGE no
MESSAGE_ADDRESS
MESSAGE_SUBJECT
MESSAGE_BODY
NEW_MAIL_MODULES no
EMAIL_HOST localhost
FROM_EMAIL mysendingmail@gmail.com
URL

Syslog tells me this, anytime I hit the "Execute" button on a filter so that an email should be sent.

zoneminder-debian zmfilter[1948]: INF [Scanning for events using filter '_TempFilter1326129225']

I'm not sure how to proceed. Am I missing something on my setup?

Thanks for your attention!

Regards,

Zumba
PacoLM
Posts: 971
Joined: Wed Dec 02, 2009 9:55 pm
Location: Spain

Re: Can't send events by email

Post by PacoLM »

A part of configuring the email, you should create a filter that has checked the send mail option. Do you have it?

After more than 15 years, no longer using ZM as surveillance system.
Now in the dark side, using a commercial system...
zumbarotinus
Posts: 10
Joined: Fri Dec 23, 2011 11:17 pm

Re: Can't send events by email

Post by zumbarotinus »

Thanks for the reply, PacoLM.

Actually I do, and when I hit the submit button I get some events that match the filter criteria.

Do you know of a way to troubleshoot zoneminder's email sending capability more directly? Without the need to create a filter that has matching events so that I can get an email to be sent.

Regards,

Zumba
PacoLM
Posts: 971
Joined: Wed Dec 02, 2009 9:55 pm
Location: Spain

Re: Can't send events by email

Post by PacoLM »

Hi,

I'm also using postfix as mailer and works fine. I'll post the settings I have so you could compare them with yours.

PacoLM

After more than 15 years, no longer using ZM as surveillance system.
Now in the dark side, using a commercial system...
zumbarotinus
Posts: 10
Joined: Fri Dec 23, 2011 11:17 pm

Re: Can't send events by email

Post by zumbarotinus »

Thanks, PacoLM!

I'd appreciate that!

Zumba
PacoLM
Posts: 971
Joined: Wed Dec 02, 2009 9:55 pm
Location: Spain

Re: Can't send events by email

Post by PacoLM »

/etc/postfix/main.cf

Code: Select all

# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = guruplug-ssd
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = guruplug-ssd, localhost.localdomain, , localhost
relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
Options:

Code: Select all

OPT_EMAIL yes
EMAIL_ADDRESS myemail@gmail.com
EMAIL_SUBJECT ZoneMinder: Alarm
EMAIL_BODY Hello, An alarm has been detected on your installation of the ZoneMinder.
OPT_MESSAGE no
MESSAGE_ADDRESS
MESSAGE_SUBJECT
MESSAGE_BODY
NEW_MAIL_MODULES no
EMAIL_HOST localhost
FROM_EMAIL mysendingmail@gmail.com
URL mypublicIPaddress.dnsserver.com
I installed postfix as internet, if I recall correctly.

Hope it helps,
PacoLM

After more than 15 years, no longer using ZM as surveillance system.
Now in the dark side, using a commercial system...
zumbarotinus
Posts: 10
Joined: Fri Dec 23, 2011 11:17 pm

Re: Can't send events by email

Post by zumbarotinus »

Thanks, PacoLM!

I think the behavior I'm having is not related to postfix configs, because I can send email using the command line, like: mail -s "Subject" etc.

Regardless, I'll try out your main.cf extract.

It seems to me that I'm missing some zoneminder configuration. Would it be possible for you to check how zoneminder manifests itself on syslog, when it succeeds in sending an email?

Cheers!

Zumba
PacoLM
Posts: 971
Joined: Wed Dec 02, 2009 9:55 pm
Location: Spain

Re: Can't send events by email

Post by PacoLM »

Code: Select all

Jan 11 06:31:18 guruplug-ssd zma_m1[1721]: INF [Frontal: 369248 - Gone into alarm state]
Jan 11 06:31:18 guruplug-ssd zma_m1[1721]: INF [Frontal: 369248 - Opening new event 15600, alarm start]
Jan 11 06:31:23 guruplug-ssd zma_m1[1721]: INF [Frontal: 369273 - Gone into alert state]
Jan 11 06:31:29 guruplug-ssd zma_m1[1721]: INF [Frontal: 369283 - Left alarm state (15600) - 45(25) images]
Jan 11 06:31:29 guruplug-ssd zma_m1[1721]: INF [Frontal: 369283 - Closing event 15600, alarm end]
Jan 11 06:32:14 guruplug-ssd zmvideo[18762]: INF [Creating video file Frontal-15600-r1-s1.avi for event 15600]
Jan 11 06:32:16 guruplug-ssd zmvideo[18762]: INF [Finished Frontal-15600-r1-s1.avi]
Jan 11 06:32:16 guruplug-ssd zmfilter[1816]: INF [Creating notification email]
Jan 11 06:32:18 guruplug-ssd zmfilter[1816]: INF [Sending notification email '2012-01-11 06:31:11 - 15600 -> Frontal']
Jan 11 06:32:18 guruplug-ssd zmfilter[1816]: INF [Attaching '/usr/share/zoneminder/events/1/12/01/11/06/31/11/00011-capture.jpg]
Jan 11 06:32:18 guruplug-ssd zmfilter[1816]: INF [Attaching '/usr/share/zoneminder/events/1/12/01/11/06/31/11/00019-capture.jpg]
Jan 11 06:32:18 guruplug-ssd zmfilter[1816]: INF [Attaching '/usr/share/zoneminder/events/1/12/01/11/06/31/11/Frontal-15600-r1-s1.avi]
Jan 11 06:32:18 guruplug-ssd postfix/smtpd[18766]: connect from localhost[127.0.0.1]
Jan 11 06:32:18 guruplug-ssd postfix/smtpd[18766]: 8419212529A: client=localhost[127.0.0.1]
Jan 11 06:32:18 guruplug-ssd postfix/cleanup[18769]: 8419212529A: message-id=<20120111053218.8419212529A@guruplug-ssd>
Jan 11 06:32:18 guruplug-ssd postfix/qmgr[1645]: 8419212529A: from=<zm@myguruplug.com>, size=124990, nrcpt=1 (queue active)
Jan 11 06:32:18 guruplug-ssd postfix/smtpd[18766]: disconnect from localhost[127.0.0.1]
Jan 11 06:32:18 guruplug-ssd zmfilter[1816]: INF [Notification email sent]
Jan 11 06:32:22 guruplug-ssd postfix/smtp[18771]: 8419212529A: to=<XXXXXXX@gmail.com>, relay=gmail-smtp-in.l.google.com[209.85.229.27]:25, delay=3.6, delays=0.43/0.07/0.75/2.4, dsn=2.0.0, status=sent (250 2.0.0 OK 1326259942 fx2si108321wbb.65)
Jan 11 06:32:22 guruplug-ssd postfix/qmgr[1645]: 8419212529A: removed

After more than 15 years, no longer using ZM as surveillance system.
Now in the dark side, using a commercial system...
PacoLM
Posts: 971
Joined: Wed Dec 02, 2009 9:55 pm
Location: Spain

Re: Can't send events by email

Post by PacoLM »

Edit: Duplicated post.
Last edited by PacoLM on Thu Jan 12, 2012 5:12 am, edited 1 time in total.

After more than 15 years, no longer using ZM as surveillance system.
Now in the dark side, using a commercial system...
zumbarotinus
Posts: 10
Joined: Fri Dec 23, 2011 11:17 pm

Re: Can't send events by email

Post by zumbarotinus »

Thank you so much, PacoLM!

I'll have a look at my setup when I get home today.
zumbarotinus
Posts: 10
Joined: Fri Dec 23, 2011 11:17 pm

Re: Can't send events by email

Post by zumbarotinus »

It turned out that postfix's main.cf wasn't the problem, after all.

I got zm to send me alarm emails, whenever I force an alarm on the monitor screen.

The thing I'm not getting to work are filters that send me emails. On the same setup I execute a filter like this one

Image

and no email is sent. Am I missing something?

Thanks!

Zumba
PacoLM
Posts: 971
Joined: Wed Dec 02, 2009 9:55 pm
Location: Spain

Re: Can't send events by email

Post by PacoLM »

Could you post the log after execute the filter?. Maybe the problem is in the zmfilter execution, not the mailer system.

Also check these values in Options::System ->
FILTER_RELOAD_DELAY 300
FILTER_EXECUTE_INTERVAL 130

After more than 15 years, no longer using ZM as surveillance system.
Now in the dark side, using a commercial system...
zumbarotinus
Posts: 10
Joined: Fri Dec 23, 2011 11:17 pm

Re: Can't send events by email

Post by zumbarotinus »

I'll do that today when I get home, Paco.

Thanks!
Locked