Sending email from ZM

Forum for questions and support relating to the 1.32.x releases only.
Post Reply
Ryandor
Posts: 2
Joined: Mon Dec 09, 2019 5:45 pm

Sending email from ZM

Post by Ryandor »

I've searched the forums (and google) and tried many things but still unable to get email notifications working correctly.
It appears to be a permissions error, and I've tried several things but can't get it resolved. Any assistance or pointers would be grateful. I'm hoping I missed something simple.

I've installed ZM from scratch several times so far. Each time I am able to get almost everything working. But email notifications is not working for. Here's all the relevant info:

"my_server" and "my_email@my_domain.com" are sanitized.
I am using a external hosting service for "my_domain.com"
If there's any info missing/needed let me know.

Ubuntu 18.04 LTS
ZM v1.32.3 installed via "Easy Way: Ubuntu 18.04 (Bionic)" PPA
Of minor note: MySQL never asked for a root user/password during setup (nor on any previous test installs).

syslog:
Dec 13 09:57:40 my_server zmfilter_6[26557]: INF [Checking filter oldcam1_event archive, video, email returned 2 events ]
Dec 13 09:57:40 my_server zmfilter_6[26557]: INF [Archiving event 5931]
Dec 13 09:57:40 my_server zmfilter_6[26557]: INF [Creating notification email]
Dec 13 09:57:40 my_server zmfilter_6[26557]: INF [Sending notification email 'ZoneMinder: Alarm - oldcam1-5931 (45 - 31 61)']
Dec 13 09:57:40 my_server sSMTP[26627]: Creating SSL connection to host
Dec 13 09:57:40 my_server sSMTP[26627]: SSL connection using ECDHE_RSA_AES_256_GCM_SHA384
Dec 13 09:57:41 my_server sSMTP[26627]: RCPT TO:<my_email@my_domain.com> (451 Temporary local problem - please try later)
Dec 13 09:57:41 my_server zmfilter_6[26557]: ERR [Unable to send email: error closing /usr/lib/sendmail: (exit 256)]
====================
ZM > Options > Email (other options tried)
OPT_EMAIL: checked
EMAIL_ADDRESS: my_email@my_domain.com
NEW_MAIL_MODULES: checked
EMAIL_HOST: localhost (my_server@localhost, my_email@my_domain.com)
FROM_EMAIL: root@localhost (my_server@localhost, my_email@my_domain.com)
SSMTP_MAIL: checked
SSMTP_PATH: /usr/sbin/ssmtp
====================
Command-line tests:
$ echo "Hello, World" | mail -s "My email check" my_email@my_domain.com - works
$ sudo -u root ssmtp -v my_email@my_domain.com < mail.txt - works
$ sudo -u www-data ssmtp -v my_email@my_domain.com < mail.txt - works
$ /usr/sbin/ssmtp -v my_email@my_domain.com < mail.txt - works
====================
ssmtp.conf:
#
# Config file for sSMTP sendmail
#
root=my_email@my_domain.com
mailhub=mail.my_domain.com:465
AuthUser=my_email@my_domain.com
AuthPass=my_password
UseTLS=YES
UesSTART-YES
rewriteDomain=my_domain.com
hostname=my_server.my_domain.com
FromLineOverride=YES
====================
revaliases:
#
# sSMTP aliases
#
root:my_email@my_domain.com:mail.my_domain.com:465
www-data:my_email@my_domain.com:mail.my_domain.com:465
====================
MMIME::Lite installed
MNet::SMTP installed
====================
/etc/ssmtp# ls -la
total 16
drwxrwxrwx 2 root mail 4096 Dec 13 10:28 .
drwxr-xr-x 113 root root 4096 Dec 13 09:54 ..
-rw-r----- 1 root www-data 108 Dec 9 18:05 revaliases
-rw-r----- 1 root www-data 232 Dec 9 18:04 ssmtp.conf

====================
/usr/lib# ls -la
...
lrwxrwxrwx 1 root root 16 Apr 3 2018 sendmail -> ../sbin/sendmail
...
====================
/usr/sbin# ls -la
...
lrwxrwxrwx 1 root root 5 Apr 3 2018 sendmail -> ssmtp
...
-rwxr-xr-x 1 root mail 39000 Apr 3 2018 ssmtp
...
====================
Per some online help I previously found:
User mail is in groups mail and www-data
User www-data is in groups www-data and mail
====================

Thank you in advance for any help.
User avatar
snake
Posts: 337
Joined: Sat May 21, 2016 2:20 am

Re: Sending email from ZM

Post by snake »

Are you sure you should have both of these? You didn't spell the second correctly. I typically use STARTTLS OR TLS.

UseTLS=YES
UesSTART-YES

Make sure your route tables are right. If it works from command line it should work in ZM. I don't think email code has had any changes since 1.30.4 from what is obvious from the GUI.

Only one of the messages in the email pane works with ssmtp (see the wiki links for more details).

All the guides / troubleshooting is at https://wiki.zoneminder.com/Email

If you have to, you can put some debugging in the zmfilter.pl script to see what is different. It looks like your email service is giving you a 451 error, so perhaps try a different email provider or find out why they are giving that error.
Ryandor
Posts: 2
Joined: Mon Dec 09, 2019 5:45 pm

Re: Sending email from ZM

Post by Ryandor »

Thank you for the reply. I corrected the typo and restarted everything. No change, same error. I'll reply back when I've tested with another email provider (but I really wanted this one to work).

Thanks.
Post Reply