[SOLVED] Sending email in ZM 1.30 with SSMTP

Forum for questions and support relating to the 1.30.x releases only.
Locked
akg1508
Posts: 26
Joined: Sun Aug 02, 2015 9:06 am

[SOLVED] Sending email in ZM 1.30 with SSMTP

Post by akg1508 »

Attempting to send email with SSMTP results in:

Code: Select all

Can't send email: error closing /usr/lib/sendmail: (exit 256)
I've tried following the instructions at: https://wiki.zoneminder.com/How_to_get_ ... Zoneminder

The main email configuration items are:

Code: Select all

OPT_EMAIL: (checked)
EMAIL_ADDRESS: (set to my personal address)
NEW_MAIL_MODULES: (checked)
EMAIL_HOST: localhost
FROM_EMAIL: (same email address as specified in ssmtp config)
SSMTP_MAIL: (checked)
SSMTP_PATH: /usr/sbin/ssmtp
I've verified that ssmtp is working by successfully sending mail using:

Code: Select all

echo "Hello, World" | mail -s "My email check" myemail@gmail.com
and

Code: Select all

ssmtp myemail@gmail.com
Hello World
^D
and

Code: Select all

sendmail myemail@gmail.com
Hello World
.
^D
Both MIME::Lite and Net::SMTP are installed (pass the test from the wiki page).

I've also tried adding an info message just before the send statement in
zmfilter.pl (line 813 of 996) to check that it really is using ssmtp and
that the path and email address are correct.

OS: Ubuntu 16.04
ZM Version: 1.30.0-trusty
Installation method: Docker https://github.com/aptalca/docker-zoneminder/tree/v1.29

Any suggestions?

Thanks very much,
Alistair
Last edited by akg1508 on Thu Oct 06, 2016 5:37 pm, edited 1 time in total.
akg1508
Posts: 26
Joined: Sun Aug 02, 2015 9:06 am

Re: Sending email in ZM 1.30 with SSMTP

Post by akg1508 »

I eventually figured this one out...

The problem was that the apache server user, www-data, didn't have
access to the ssmtp configuration files. To get it working, I just
granted read access to the www-data user, the real solution can be found
at:

https://wiki.archlinux.org/index.php/SSMTP

HTH,
Alistair
yippeeee25
Posts: 2
Joined: Fri Aug 04, 2017 12:26 am

Re: [SOLVED] Sending email in ZM 1.30 with SSMTP

Post by yippeeee25 »

Hi Alistair, is there any chance you can go into more detail on how you fixed this? I have the exact same problem and I did exactly what you did for troubleshooting, but I am stuck where you said that you gave the www-data user read access.

Here are the permissions for my config files:

-rw-rw-rw- 1 nobody users 297 Aug 3 00:04 revaliases
-rw-rw-rw- 1 nobody users 232 Aug 3 20:11 ssmtp.conf

and

root:/etc/ssmtp# groups www-data
www-data : users video
akg1508
Posts: 26
Joined: Sun Aug 02, 2015 9:06 am

Re: [SOLVED] Sending email in ZM 1.30 with SSMTP

Post by akg1508 »

Hi @yippeeee25,

I'm a bit out of my depth here, but I think the problem is that the files are owned by "nobody":

-rw-r----- 1 root www-data 296 Oct 3 2016 revaliases
-rw-r----- 1 root www-data 194 Oct 3 2016 ssmtp.conf

HTH,
Alistair
yippeeee25
Posts: 2
Joined: Fri Aug 04, 2017 12:26 am

Re: [SOLVED] Sending email in ZM 1.30 with SSMTP

Post by yippeeee25 »

Unfortunately that didn't help. I just changed to the following and I'm getting the same error. Thanks anyway.

-rwxrwxrwx 1 root www-data 96 Aug 3 23:56 revaliases
-rwxrwxrwx 1 root www-data 194 Aug 3 23:55 ssmtp.conf
bobylapointe69300
Posts: 10
Joined: Wed Feb 14, 2018 6:51 pm

Re: [SOLVED] Sending email in ZM 1.30 with SSMTP

Post by bobylapointe69300 »

Have you tested your config with below commands (from unix.stackexchange forum)?
First you need to create a mail.txt file with some text.

Code: Select all

$ nano mail.txt
$ sudo -u root ssmtp -v my.own.email@gmail.com < mail.txt
$ sudo -u www-data ssmtp -v my.own.email@gmail.com < mail.txt
$ /usr/sbin/ssmtp -v my.own.email@gmail.com < mail.txt
If one of these fails, then you still have problems with permissions/owners... Check also the "mail" group, as you might want to add www-data to this group.

You can open another terminal with this to look for email error messages also:

Code: Select all

$ tail -f /var/log/syslog
I hope this helps.
Locked