PHPmailer failed to send email

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
mansonli
Posts: 60
Joined: Wed Aug 05, 2020 1:54 am

PHPmailer failed to send email

Post 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
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: PHPmailer failed to send email

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
mansonli
Posts: 60
Joined: Wed Aug 05, 2020 1:54 am

Re: PHPmailer failed to send email

Post 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
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: PHPmailer failed to send email

Post 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):

Code: Select all

public $SMTPAutoTLS = false;
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?

Code: Select all

php -v
mansonli
Posts: 60
Joined: Wed Aug 05, 2020 1:54 am

Re: PHPmailer failed to send email

Post 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
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: PHPmailer failed to send email

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked