Email Questions with Events

Forum for questions and support relating to the 1.30.x releases only.
Locked
darkled
Posts: 12
Joined: Thu Dec 08, 2016 2:24 am

Email Questions with Events

Post by darkled »

Hello everyone!
Recently installed ZoneMinder.
Just upgraded to 1.30.0

I am following this guide on how to setup emails...
If I send a test email from the command line, it works.
Yet if I "force" an alarm, it doesn't work.

I am tailing /var/log/syslog, and I get this:
Dec 7 22:27:17 zoneminder zmfilter[1323]: INF [Creating notification email]
Dec 7 22:27:18 zoneminder zmfilter[1323]: INF [Sending notification email 'ZoneMinder: Alarm - Garage-1a-3 (69 - 33 159)']
Dec 7 22:27:18 zoneminder zmfilter[1323]: INF [Attaching '/usr/share/zoneminder/www/events/6/16/12/05/20/19/59/00026-capture.jpg]
Dec 7 22:27:18 zoneminder zmfilter[1323]: INF [Attaching '/usr/share/zoneminder/www/events/6/16/12/05/20/19/59/00028-capture.jpg]
Dec 7 22:27:18 zoneminder zmfilter[1323]: ERR [Can't send email: SMTP Failed to connect to mail server: Connection refused#012 at /usr/bin/zmfilter.pl line 818.]

This is a fresh Ubuntu 16.04 server installation, with all updates as of today.
I made sure the system has installed MIME::Lite and NET::SMTP

Any idea what I am doing wrong?

Thank you!
darkled
Posts: 12
Joined: Thu Dec 08, 2016 2:24 am

Re: Email Questions with Events

Post by darkled »

Just found some additional information that might help here::
https://github.com/PHPMailer/PHPMailer/ ... leshooting
I am going to try this and will report back.
darkled
Posts: 12
Joined: Thu Dec 08, 2016 2:24 am

Re: Email Questions with Events

Post by darkled »

Ok, I am not getting progress.
If I try to send an email from the command line, I run:
# echo "Hello world!" | mail -s "My email check #3" MYGMAILACCOUNT@gmail.com
And it works perfectly.
I receive the email.

I am tailing /var/log/syslog, and it shows:
Dec 8 22:40:07 zoneminder sSMTP[11131]: Creating SSL connection to host
Dec 8 22:40:07 zoneminder sSMTP[11131]: SSL connection using RSA_AES_128_CBC_SHA1
Dec 8 22:40:09 zoneminder sSMTP[11131]: Sent mail for MYGMAILACCOUNT@gmail.com (221 2.0.0 closing connection i62sm8482323uai.26 - gsmtp) uid=0 username=root outbytes=463


Yet if I try to send the email from ZoneMinder, I get:
Dec 8 22:52:26 zoneminder zmfilter[11370]: ERR [Can't send email: SMTP Failed to connect to mail server: Connection refused#012 at /usr/bin/zmfilter.pl line 818.]
darkled
Posts: 12
Joined: Thu Dec 08, 2016 2:24 am

Re: Email Questions with Events

Post by darkled »

Well, from this link:
https://wiki.zoneminder.com/How_to_get_ ... Zoneminder

I am supposed to get the file:
/usr/bin/zmfilter.pl

With the lines like the following:
### Send the Message
#MIME::Lite->send( "sendmail", $Config{ZM_EMAIL_HOST}, Timeout=>60 );
$mail->send('sendmail','/usr/sbin/ssmtp',$Config{ZM_EMAIL_ADDRESS});
#$mail->send();


I have it like that, and... nothing.
Not working.
Not sure what... what to do.

Any help please?
darkled
Posts: 12
Joined: Thu Dec 08, 2016 2:24 am

Re: Email Questions with Events

Post by darkled »

Bump.
Any help please?
I am not progressing on this issue.
Any suggestions as to what to try?
Paranoid
Posts: 129
Joined: Thu Feb 05, 2009 10:40 pm

Re: Email Questions with Events

Post by Paranoid »

What do you have EMAIL_HOST set to? Whatever you have it set to must have a mail server running.
Try the following:

Code: Select all

telnet localhost smtp
If it connects then your mail server is listening on the localhost interface so set EMAIL_HOST to localhost.
darkled
Posts: 12
Joined: Thu Dec 08, 2016 2:24 am

Re: Email Questions with Events

Post by darkled »

Thank you for the reply!
The EMAIL_HOST I have it set to "localhost".

If I try the
telnet localhost smtp

It returns that it's unable to connecdt to remote host: Connection refused.

Did I miss something basic?
darkled
Posts: 12
Joined: Thu Dec 08, 2016 2:24 am

Re: Email Questions with Events

Post by darkled »

Ok, I installed postfix.
I am tailing /var/log/mail.log

and I am getting:
Dec 12 22:19:54 zoneminder postfix/smtp[8105]: 431CE1632E4: to=<MYGMAIL@gmail.com>, relay=smtp.gmail.com[74.125.141.109]:587, delay=0.27, delays=0.1/0/0.12/0.04, dsn=5.7.0, status=bounced (host smtp.gmail.com[74.125.141.109] said: 530 5.7.0 Must issue a STARTTLS command first. i68sm12488285uad.23 - gsmtp (in reply to MAIL FROM command))

Yet I have triple-checked the configuration in
/etc/postfix/main.cf

and it shows everything as it should.

I am going bonkers with this thing.
darkled
Posts: 12
Joined: Thu Dec 08, 2016 2:24 am

Re: Email Questions with Events

Post by darkled »

Jesus christ allmight it worked.

Everything was this link.

A guy in the comments states:
Anyway smtp_use_tls=yes is obsolete and superseded by smtp_tls_security_level = encrypt. OP could do without it
So I changed that line out in /etc/postfix/main.cf
commented out

Code: Select all

#smtpd_use_tls = yes
The inserted:

Code: Select all

smtp_tls_security_level = encrypt
Then restart postfix with:

Code: Select all

systemctl restart postfix.service
Forced an alarm... tested... and email arrived!

Heck yeah!!

Do I have permission to edit the ZoneMinder wiki?
I think it would be a good addition to mention this.
Locked