THOLD ERROR: Sending Email Failed. Error was SMTP connect()

Support questions about the Threshold plugin

Moderators: Developers, Moderators

Post Reply
maguayver
Posts: 3
Joined: Mon Apr 09, 2018 6:52 pm

THOLD ERROR: Sending Email Failed. Error was SMTP connect()

Post by maguayver »

Guys, good night.
I configured Cacti 1.1.37 to send mail in the settings tab - mail / reporting / dns and /thresholds but it gives an error and does not send the email notifying that the host is offline or when it came back online.
I already consulted PHPMailer but I do not know where to configure it.
Can someone help me?
My Settings:

Mail Services SMTP
Ping Mail Server Yes
From Email Address myemail@gmail.com
From Name Cacti Server Monitor
Word Wrap 120
SMTP Hostname smtp.gmail.com
SMTP Port 465
SMTP Username myemail
SMTP Password ****
SMTP Security SSL
SMTP Timeout 10

Thank you.
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: THOLD ERROR: Sending Email Failed. Error was SMTP connec

Post by netniV »

Try using the test program I posted : viewtopic.php?p=272027#p272027

You'll have to rename from .txt to .php.

That will give you a lot more information about what is occurring.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
maguayver
Posts: 3
Joined: Mon Apr 09, 2018 6:52 pm

Re: THOLD ERROR: Sending Email Failed. Error was SMTP connec

Post by maguayver »

Good Evening,
I ran the file "test_mail.php" and showed these errors:

root@Server:/var/www/html/include# php test_mail.php
Checking Configuration...Method: SMTP
Ping Results: Bypassed
Sending Message...2018-04-19 01:54:08 Connection: opening to ssl://smtp.gmail.com:465, timeout=10, options=array (
)
2018-04-19 01:54:09 Connection failed. Error #2: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed [/var/www/html/include/phpmailer/class.smtp.php line 298]
2018-04-19 01:54:09 Connection failed. Error #2: stream_socket_client(): Failed to enable crypto [/var/www/html/include/phpmailer/class.smtp.php line 298]
2018-04-19 01:54:09 Connection failed. Error #2: stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465 (Unknown error) [/var/www/html/include/phpmailer/class.smtp.php line 298]
2018-04-19 01:54:09 SMTP ERROR: Failed to connect to server: (0)
2018-04-19 01:54:09 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/ ... leshooting

Result: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/ ... leshooting

Thanks...
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: THOLD ERROR: Sending Email Failed. Error was SMTP connec

Post by netniV »

So that basically means you need to enable the SSL/Crypto libraries within PHP. WIthout those, it won't be able to talk properly to gmail.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: THOLD ERROR: Sending Email Failed. Error was SMTP connec

Post by netniV »

Actually, I take that back I reckon it's down to your ISP redirecting the SMTP traffic from gmail to their own servers.

GMail wouldn't have an invalid certificate. As long as you have openssl enabled in both the cli and apache/ngix PHP configuration files then it should work properly as is.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
User avatar
camerabob
Cacti User
Posts: 386
Joined: Fri Feb 10, 2017 2:45 pm
Location: Long Island, New York, USA
Contact:

Re: THOLD ERROR: Sending Email Failed. Error was SMTP connec

Post by camerabob »

See the fourth post in the linked thread: viewtopic.php?f=21&t=58573

There it boiled down to the ISP (Verizon) not allowing mail from any server other than their own. Other ISPs may have adopted the same policy to avoid email UBE (Unsolicited Bulk Email) issues.
Prod: Cacti 1.2.15 @ CentOS Linux release 7.9.2009 (Core) & PHP 5.4.16-48.el7
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

Temp: Cacti 1.2.3 @ CentOS Linux release 7.9.2009 (Core) & PHP 5.4.16-48.el7
Flowview @ 2.1
Mactrack @ 4.2
Maint @ 1.2
Monitor @ 2.3.6
Router Configs @ 1.3.4
Syslog Monitoring @ 2.1
Thold @ 1.2.4
maguayver
Posts: 3
Joined: Mon Apr 09, 2018 6:52 pm

Re: THOLD ERROR: Sending Email Failed. Error was SMTP connec

Post by maguayver »

Guys, no is problem of server Gmail, I tested in server smtp of Outlook and in server smtp Yahoo, same error, See:

root@CACTI-SERVER1:/usr/share/cacti/site/include# php test_mail.php
Checking Configuration...Method: SMTP
Ping Results: Bypassed
Sending Message...2018-04-23 01:48:29 Connection: opening to smtp.mail.yahoo.com:587, timeout=10, options=array (
)
2018-04-23 01:48:29 Connection: opened
2018-04-23 01:48:29 SERVER -> CLIENT: 220 smtp.mail.yahoo.com ESMTP ready
2018-04-23 01:48:29 CLIENT -> SERVER: EHLO CACTI-SERVER1
2018-04-23 01:48:30 SERVER -> CLIENT: 250-smtp419.mail.ir2.yahoo.com Hello CACTI-SERVER1 [177.97.253.47])
250-PIPELINING
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-SIZE 41697280
250 STARTTLS
2018-04-23 01:48:30 CLIENT -> SERVER: STARTTLS
2018-04-23 01:48:30 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
2018-04-23 01:48:31 Connection failed. Error #2: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed [/usr/share/cacti/site/include/phpmailer/class.smtp.php line 374]
2018-04-23 01:48:31 SMTP Error: Could not connect to SMTP host.
2018-04-23 01:48:31 CLIENT -> SERVER: QUIT
2018-04-23 01:48:31 Connection failed. Error #8: fwrite(): send of 6 bytes failed with errno=32 Broken pipe [/usr/share/cacti/site/include/phpmailer/class.smtp.php line 999]
2018-04-23 01:48:31 SERVER -> CLIENT: ,


What do I do to solve it?

Thank you.
User avatar
camerabob
Cacti User
Posts: 386
Joined: Fri Feb 10, 2017 2:45 pm
Location: Long Island, New York, USA
Contact:

Re: THOLD ERROR: Sending Email Failed. Error was SMTP connec

Post by camerabob »

Does your email client work sending email with any of those mailboxes? If it does work, did you match those settings exactly?
Prod: Cacti 1.2.15 @ CentOS Linux release 7.9.2009 (Core) & PHP 5.4.16-48.el7
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

Temp: Cacti 1.2.3 @ CentOS Linux release 7.9.2009 (Core) & PHP 5.4.16-48.el7
Flowview @ 2.1
Mactrack @ 4.2
Maint @ 1.2
Monitor @ 2.3.6
Router Configs @ 1.3.4
Syslog Monitoring @ 2.1
Thold @ 1.2.4
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: THOLD ERROR: Sending Email Failed. Error was SMTP connec

Post by netniV »

It sounds like what we have already said. Your ISP is blocking the outgoing smtp connection. Contact them to verify this.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest