Page 1 of 1

Random SMTP send failures with Office 365

Posted: Thu Apr 06, 2017 11:30 am
by gmackey
Hello,

I've noticed that I haven't received several email notifications from Nagios XI since we switched from a local SMTP proxy to directly sending to Office 365. The notifications are recorded in Nagios XI as being sent but they are never received. I know of cases in which some co-workers received an alert that I did not, even though Nagios XI has recorded that it sent one to me. I have debugging enabled for PHPMailer and here's an example from last night that shows a few failures in between successes. Is there some way to have PHPMailer retry on failure and keep retrying until it sends those failed messages?

Code: Select all

[04-05-2017 22:12:16] Message sent! (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email
[04-05-2017 22:12:25] Message sent! (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email
[04-05-2017 22:12:28] Message sent! (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email
[04-05-2017 22:12:33] Message sent! (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email
[04-05-2017 22:12:39] Message sent! (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email
[04-05-2017 22:12:42] Message sent! (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email
[04-05-2017 22:12:48] Message sent! (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Mobile Text
[04-05-2017 22:12:54] Message sent! (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email
[04-05-2017 22:17:08] Message sent! (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email
[04-05-2017 22:17:13] Message sent! (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email
[04-05-2017 22:17:15] SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email
[04-05-2017 22:17:23] Message sent! (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email
[04-05-2017 22:17:30] Message sent! (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email
[04-05-2017 22:17:34] SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email
[04-05-2017 22:17:43] SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Mobile Text
[04-05-2017 22:17:52] Message sent! (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email
[04-05-2017 22:17:57] Message sent! (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email
[04-05-2017 22:18:00] Message sent! (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email
[04-05-2017 22:18:02] Message sent! (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email
[04-05-2017 22:18:07] Message sent! (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email
[04-05-2017 22:18:11] SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Mobile Text
[04-05-2017 22:18:20] Message sent! (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email
[04-05-2017 22:18:26] Message sent! (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email
[04-05-2017 23:21:44] Message sent! (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email
[04-05-2017 23:21:49] SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email
[04-05-2017 23:21:58] Message sent! (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email
[04-05-2017 23:22:01] Message sent! (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email
[04-05-2017 23:22:05] Message sent! (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Mobile Text
[04-05-2017 23:22:09] Message sent! (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email
[04-05-2017 23:22:13] SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting (method=smtp;host=smtp.office365.com;port=587;smtpauth=true;security=tls), Referer: includes/components/xicore/xicore.inc.php > Event Handler Notification Email

Re: Random SMTP send failures with Office 365

Posted: Thu Apr 06, 2017 2:12 pm
by mcapra
gmackey wrote:Is there some way to have PHPMailer retry on failure and keep retrying until it sends those failed messages?
Not really, but this isn't the first time we've seen direct connections to smtp.office365.com behave strangely. Typically, we recommend people use a relay rather than connecting to office365.com directly. Is using a relay an option in your environment? That'd be one way to have queuing; Let something like postfix deal with it.

Re: Random SMTP send failures with Office 365

Posted: Thu Apr 06, 2017 3:04 pm
by gmackey
Yep, this is all I needed to justify going back to using the relay. We have to have a relay for other devices (UPS, HVAC, etc.) that don't support one or more of the requirements for Office 365 auth anyway, not to mention in-house apps since we don't want to have to build a queueing system for those messages if they can't be immediately delivered. Thank you, please lock this thread.

Re: Random SMTP send failures with Office 365

Posted: Thu Apr 06, 2017 4:07 pm
by mcapra
Happy to provide an excuse to use a relay :) Feel free to open a new thread if you have additional problems with Office365 emails.