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

Support questions about the Threshold plugin

Moderators: Moderators, Developers

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

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

#1 Post by maguayver » Mon Apr 09, 2018 6:58 pm

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 [email protected]
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: 2670
Joined: Sun Aug 27, 2017 12:05 am

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

#2 Post by netniV » Thu Apr 12, 2018 7:30 am

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.

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

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

#3 Post by maguayver » Wed Apr 18, 2018 8:56 pm

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

[email protected]:/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: 2670
Joined: Sun Aug 27, 2017 12:05 am

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

#4 Post by netniV » Thu Apr 19, 2018 2:37 am

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.

netniV
Cacti Guru User
Posts: 2670
Joined: Sun Aug 27, 2017 12:05 am

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

#5 Post by netniV » Thu Apr 19, 2018 3:00 am

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.

User avatar
camerabob
Cacti User
Posts: 275
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

#6 Post by camerabob » Thu Apr 19, 2018 7:15 am

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.
See the Cacti 1.x templates I use at: http://www.camerabob.com/cacti

Live: Cacti 1.2.3 @ CentOS 7-6.1810.2.el7 & PHP 5.4.16-46.el7
Flowview @ 2.1
Mactrack @ 4.2
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

Test: Cacti 1.2.4 @ CentOS 7-6.1810.2.el7 & PHP 5.4.16-46.el7
Maint @ 1.2
Monitor @ 2.3.6
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

#7 Post by maguayver » Sun Apr 22, 2018 8:59 pm

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

[email protected]:/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: 275
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

#8 Post by camerabob » Sun Apr 22, 2018 9:51 pm

Does your email client work sending email with any of those mailboxes? If it does work, did you match those settings exactly?
See the Cacti 1.x templates I use at: http://www.camerabob.com/cacti

Live: Cacti 1.2.3 @ CentOS 7-6.1810.2.el7 & PHP 5.4.16-46.el7
Flowview @ 2.1
Mactrack @ 4.2
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

Test: Cacti 1.2.4 @ CentOS 7-6.1810.2.el7 & PHP 5.4.16-46.el7
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

netniV
Cacti Guru User
Posts: 2670
Joined: Sun Aug 27, 2017 12:05 am

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

#9 Post by netniV » Tue Apr 24, 2018 12:21 pm

It sounds like what we have already said. Your ISP is blocking the outgoing smtp connection. Contact them to verify this.

Post Reply