Page 1 of 1
PHPmailer failed to send email
Posted: Wed Sep 16, 2020 7:05 am
by mansonli
Failed to send test email via SMTP. Tested connection to smtphk.ap.manulife.com:25 can be established. Email can be delivered to recipient by telnet to above SMTP server. What cause Mailer failed to connect and relay email?
Mailer said: [09-16-2020 19:55:05] SMTP connect() failed.
https://github.com/PHPMailer/PHPMailer/ ... leshooting (method=smtp;host=smtphk.ap.manulife.com;port=25;security=none), Referer: admin/testemail.php
An error occurred sending a test email!
Connected to smtphk.ap.manulife.com.
Escape character is '^]'.
220 hklismtpaep01.ap.manulife.com ESMTP Symantec Messaging Gateway
Re: PHPmailer failed to send email
Posted: Wed Sep 16, 2020 5:27 pm
by benjaminsmith
Hi,
Thank you for contacting the Nagios Support Team.
Let's turn on the debug output to help troubleshoot this further. Please follow the steps in the kb article below and then post a screenshot of the error when sending the test email.
https://support.nagios.com/kb/article.php?id=820
Regards,
Benjamin
Re: PHPmailer failed to send email
Posted: Wed Sep 16, 2020 10:34 pm
by mansonli
Debug output is as follows. Is the delivery failure caused by smtphk.ap.manulife.com rejected connection?
2020-09-17 03:24:04 Connection: opening to smtphk.ap.manulife.com:25, timeout=300, options=array ( ) 2020-09-17 03:24:04 Connection: opened 2020-09-17 03:24:04 SMTP -> get_lines(): $data is "" 2020-09-17 03:24:04 SMTP -> get_lines(): $str is "220 hklismtpaep01.ap.manulife.com ESMTP Symantec Messaging Gateway " 2020-09-17 03:24:04 SERVER -> CLIENT: 220 hklismtpaep01.ap.manulife.com ESMTP Symantec Messaging Gateway 2020-09-17 03:24:04 CLIENT -> SERVER: EHLO <ip address> 2020-09-17 03:24:04 SMTP -> get_lines(): $data is "" 2020-09-17 03:24:04 SMTP -> get_lines(): $str is "250-hklismtpaep01.ap.manulife.com says EHLO to <ip address>:51484 " 2020-09-17 03:24:04 SMTP -> get_lines(): $data is "250-hklismtpaep01.ap.manulife.com says EHLO to <ip address>:51484 " 2020-09-17 03:24:04 SMTP -> get_lines(): $str is "250-STARTTLS " 2020-09-17 03:24:04 SMTP -> get_lines(): $data is "250-hklismtpaep01.ap.manulife.com says EHLO to <ip address>:51484 250-STARTTLS " 2020-09-17 03:24:04 SMTP -> get_lines(): $str is "250-PIPELINING " 2020-09-17 03:24:04 SMTP -> get_lines(): $data is "250-hklismtpaep01.ap.manulife.com says EHLO to <ip address>:51484 250-STARTTLS 250-PIPELINING " 2020-09-17 03:24:04 SMTP -> get_lines(): $str is "250-SIZE 250485760 " 2020-09-17 03:24:04 SMTP -> get_lines(): $data is "250-hklismtpaep01.ap.manulife.com says EHLO to <ip address>:51484 250-STARTTLS 250-PIPELINING 250-SIZE 250485760 " 2020-09-17 03:24:04 SMTP -> get_lines(): $str is "250-8BITMIME " 2020-09-17 03:24:04 SMTP -> get_lines(): $data is "250-hklismtpaep01.ap.manulife.com says EHLO to <ip address>:51484 250-STARTTLS 250-PIPELINING 250-SIZE 250485760 250-8BITMIME " 2020-09-17 03:24:04 SMTP -> get_lines(): $str is "250 ENHANCEDSTATUSCODES " 2020-09-17 03:24:04 SERVER -> CLIENT: 250-hklismtpaep01.ap.manulife.com says EHLO to <ip address>:51484 250-STARTTLS 250-PIPELINING 250-SIZE 250485760 250-8BITMIME 250 ENHANCEDSTATUSCODES 2020-09-17 03:24:04 CLIENT -> SERVER: STARTTLS 2020-09-17 03:24:04 SMTP -> get_lines(): $data is "" 2020-09-17 03:24:04 SMTP -> get_lines(): $str is "220 2.0.0 continue " 2020-09-17 03:24:04 SERVER -> CLIENT: 220 2.0.0 continue 2020-09-17 03:24:04 SMTP Error: Could not connect to SMTP host. 2020-09-17 03:24:04 SMTP NOTICE: EOF caught while checking if connected 2020-09-17 03:24:04 Connection: closed 2020-09-17 03:24:04 SMTP connect() failed.
https://github.com/PHPMailer/PHPMailer/ ... leshooting
Re: PHPmailer failed to send email
Posted: Thu Sep 17, 2020 5:01 pm
by ssax
I think it's trying to use STARTTLS even though you do not have that defined.
Please edit this file:
Code: Select all
/usr/local/nagiosxi/html/includes/phpmailer/class.phpmailer.php
Make sure this is set (around line 260):
Then test again.
What XI version are you running? You can find it on the bottom left hand side of the web interface.
What version of PHP are you running?
Re: PHPmailer failed to send email
Posted: Fri Sep 18, 2020 2:37 am
by mansonli
Can receive test email after changing public $SMTPAutoTLS to false.
current XI version is 5.4.8.
$ php -v
PHP 5.4.16 (cli) (built: Oct 29 2019 09:56:22)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
Re: PHPmailer failed to send email
Posted: Fri Sep 18, 2020 5:17 pm
by benjaminsmith
Hi,
Can receive test email after changing public $SMTPAutoTLS to false.
Sounds like it's working for you now. Did you have any other questions or may we close this thread?
Regards,
Benajmin