Page 1 of 1

Errors on Phpmailer.log

Posted: Wed Aug 08, 2018 1:53 pm
by thrivikramr
Email notifications are not sent when using Office365 SMTP. Messages were going through, but stopped all of a sudden.
Errors now -
[08-08-2018 00:08:13] SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/ ... leshooting (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email

Re: Errors on Phpmailer.log

Posted: Wed Aug 08, 2018 3:46 pm
by syang
Hello ThriVikram,

This is likely an authentication issue. Please check the SMTP login and password to make sure there are no special characters in the password, and check if the SMTP server is set with the correct security and port numbers.
You can take a look at the phpmailer.log file to see what the output says.

Head to the "Manage Email Settings" and click on Debug Log then update your settings.

Under

Code: Select all

/usr/local/nagiosxi/html/includes/phpmailer/class.phpmailer.php
, edit line 329 to show

Code: Select all

public $SMTPDebug = 2
Send a test email and see the output on the top of the web UI. It should be a lengthy output but towards the end, it will give you an SMTP error such as

Code: Select all

SMTP ERROR: Password command failed: 535 Incorrect authentication data 2018-08-08 20:38:48	SMTP Error: Could not authenticate.

Re: Errors on Phpmailer.log

Posted: Wed Aug 08, 2018 4:10 pm
by thrivikramr
SMTP outbound traffic on port 587 is allowed on the firewall, so that is not the issue. Should be an application issue.

Re: Errors on Phpmailer.log

Posted: Thu Aug 09, 2018 8:32 am
by mcapra
Are you absolutely certain you're supposed to be connecting directly to smtp.office365.com? Many orgs setup a relay server to service Office365 mail logins.

Have you tried using SSL based security on port 993? Does this work?

If it is indeed a client-side issue as you assert, the debug steps provided by @syang would give us valuable output. I would suggest following them and sharing the requested results.

Re: Errors on Phpmailer.log

Posted: Thu Aug 09, 2018 12:47 pm
by tgriep
Thanks everyone for the help.

If there were no changes done to the Nagios server, I may be that the user account is expired or disabled.
Can you login to the Office365 server using the user account and verify that it is active?

Re: Errors on Phpmailer.log

Posted: Thu Aug 09, 2018 1:09 pm
by thrivikramr
It is showing as Authentication unsuccessful, will try to configure our orgs relay settings

TLS - 587

2018-08-09 15:59:04 SERVER -> CLIENT: 220 BN3PR05CA0019.outlook.office365.com Microsoft ESMTP MAIL Service ready at Thu, 9 Aug 2018 15:59:03 +0000 2018-08-09 15:59:04 CLIENT -> SERVER: EHLO serv1.x.com 2018-08-09 15:59:04 SERVER -> CLIENT: 250-BN3PR05CA0019.outlook.office365.com Hello [63.239.255.200] 250-SIZE 157286400 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-STARTTLS 250-8BITMIME 250-BINARYMIME 250-CHUNKING 250 SMTPUTF8 2018-08-09 15:59:04 CLIENT -> SERVER: STARTTLS 2018-08-09 15:59:04 SERVER -> CLIENT: 220 2.0.0 SMTP server ready 2018-08-09 15:59:04 CLIENT -> SERVER: EHLO serv1.x.com 2018-08-09 15:59:04 SERVER -> CLIENT: 250-BN3PR05CA0019.outlook.office365.com Hello [63.239.255.200] 250-SIZE 157286400 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-AUTH LOGIN XOAUTH2 250-8BITMIME 250-BINARYMIME 250-CHUNKING 250 SMTPUTF8 2018-08-09 15:59:04 CLIENT -> SERVER: AUTH LOGIN 2018-08-09 15:59:04 SERVER -> CLIENT: 334 VXNlcm5hbWU6 2018-08-09 15:59:04 CLIENT -> SERVER: dGhyaXZpa3JhbS5yZWRkeS5uYXJha2FAc2FwLmNvbQ== 2018-08-09 15:59:04 SERVER -> CLIENT: 334 UGFzc3dvcmQ6 2018-08-09 15:59:04 CLIENT -> SERVER: YXAwM040OTg2 2018-08-09 15:59:11 SERVER -> CLIENT: 535 5.7.3 Authentication unsuccessful [BN3PR05CA0019.namprd05.prod.outlook.com] 2018-08-09 15:59:11 SMTP ERROR: Password command failed: 535 5.7.3 Authentication unsuccessful [BN3PR05CA0019.namprd05.prod.outlook.com] 2018-08-09 15:59:11 SMTP Error: Could not authenticate. 2018-08-09 15:59:11 CLIENT -> SERVER: QUIT 2018-08-09 15:59:11 SERVER -> CLIENT: 221 2.0.0 Service closing transmission channel 2018-08-09 15:59:11 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/ ... leshooting
Test Email Settings
A test email was sent to [email protected]
----
Mailer said: [08-09-2018 08:59:04] SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/ ... leshooting (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: admin/testemail.php
An error occurred sending a test email!

Re: Errors on Phpmailer.log

Posted: Thu Aug 09, 2018 1:39 pm
by tgriep
Ok, thanks for the update. Let us know if you have any further questions.