SSMTP connection refused

Forum for questions and support relating to the 1.30.x releases only.
Post Reply
seraph
Posts: 2
Joined: Fri Oct 06, 2017 10:22 pm

SSMTP connection refused

Post by seraph » Fri Oct 06, 2017 10:52 pm

Hi,

I'm using ZoneMinder 1.30.4 on Ubuntu Desktop 16.04 LTS

I have followed SSMTP instruction (https://wiki.zoneminder.com/How_to_get_ ... Zoneminder) to setup email that use gmail SMTP. I also didn't make any changes on the /usr/bin/zmfilter.pl file, as my version is 1.30.4 and I have ticked the NEW_MAIL_MODULES option.

The following are my email settings:
Screen Shot 2017-10-07 at 7 Oct 17,09.44.57.png
Screen Shot 2017-10-07 at 7 Oct 17,09.44.57.png (310.73 KiB) Viewed 1789 times
When I do a manual testing

Code: Select all

echo "Hello, World" | mail -s "My email check" email@gmail.com
It works and I have received the email (which indicated that the ssmtp.conf and revaliases configurations are correct).

Unfortunately, when I forced alarm and send the event by email (as instructed by the page), it throws this error inside /var/log/syslog

Code: Select all

ERR [Can't send email: SMTP Failed to connect to mail server: Connection refused#012 at /usr/bin/zmfilter.pl line 817.]
I have checked another thread (viewtopic.php?t=25346), someone says that I need to check the SSMTP config files permission; I did mine and the following is the original one:
Screen Shot 2017-10-07 at 7 Oct 17,09.49.07.png
Screen Shot 2017-10-07 at 7 Oct 17,09.49.07.png (88.67 KiB) Viewed 1789 times
and the following after the change ownership:
Screen Shot 2017-10-07 at 7 Oct 17,09.49.14.png
Screen Shot 2017-10-07 at 7 Oct 17,09.49.14.png (122.41 KiB) Viewed 1789 times
Unfortunately, still no email is received.
Can someone please let me know what else should I check now?


Also, another thing, when I tried to change the logging of LOG_LEVEL_SYSLOG to DEBUG, the /var/log/syslog still shows the info information only (even after zoneminder restart)

rockedge
Posts: 1098
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA
Contact:

Re: SSMTP connection refused

Post by rockedge » Sun Oct 08, 2017 2:12 pm

did you increase the Debug Level?

seraph
Posts: 2
Joined: Fri Oct 06, 2017 10:22 pm

Re: SSMTP connection refused

Post by seraph » Mon Oct 09, 2017 5:21 am

I did, but strangely the log results are the same

rockedge
Posts: 1098
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA
Contact:

Re: SSMTP connection refused

Post by rockedge » Mon Oct 09, 2017 2:28 pm

did you check /var/log/zm for the debug logs? Do your filters work? anything in this thread pertain to your situation?
viewtopic.php?f=36&t=26540

borgatt
Posts: 1
Joined: Fri Dec 08, 2017 5:37 pm

Re: SSMTP connection refused

Post by borgatt » Fri Dec 08, 2017 5:42 pm

I was having the same exact issue, recently just got it working. In the https://wiki.zoneminder.com/How_to_get_ ... Zoneminder article, it says:

Below two options in 1.30 or higher
SSMTP_Mail: check this off.
SSMTP_Path: Depends on your distribution. Try $ whereis ssmtp


I checked the SSMTP_Mail box
for path I entered /etc/ssmtp/

After that the zoneminder tests worked. Hope this helps.

swerve8
Posts: 1
Joined: Sun Jun 09, 2019 4:18 am

Re: SSMTP connection refused

Post by swerve8 » Sun Jun 09, 2019 4:32 am

I too had this issue and through many many google searches I was able to find my solution and I wanted to include my major mistakes and how I ultimately resolve the issue.

Can't send email: error closing /usr/lib/sendmail: (exit 256)

Tip 1: check your config based on this guide https://wiki.zoneminder.com/index.php/H ... Zoneminder?
Tip 2: DOUBLE CHECK the ssmtp.conf entries and the revaliases. (one of my issues was I had a stupid "." instead of a ":" for the www-data entry.)
Tip 3: Try to isolate the issue outside of ZoneMinder I found a helpful suggestion on a different post

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

$ 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. " from user bobylapointe69300 viewtopic.php?t=25346

Tip 4: Check your perl installations for MMIME::Lite and MNet::SMTP I glossed over this

Making sure you have MIME::Lite and Net::SMTP
So after getting various errors, I discovered Ubuntu Server did not install MIME::Lite with its default install.

It's good idea to install them if you don't have it. To check if you have them:

perl -MMIME::Lite -e "print \"Module installed.\\n\";"
perl -MNet::SMTP -e "print \"Module installed.\\n\";"

And to install:

sudo perl -MCPAN -e shell
install MIME::Lite
install Net::SMTP

Tip 5: check the permissions of the ssmtp files "ssmtp.conf" "revaliases" to ensure www-data has read access to them.

Tip 6 tail -f /var/log/syslog is your friend. Use it and watch the output when you think your filter is firing off. I noticed at some point during my troubleshooting that my event was firing but it wasnt producing any results to email me about. Its a good way to see whats going on when your filters run and whats going wrong.

I know some of this is redundant but I wanted to consolidate all of it in one place.

Thanks to everyone for their support best of luck.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest