Home » Categories » Multiple Categories

PHPMailer - Troubleshooting Using Debug Logging

Overview

This KB article explains how you can enable debug logging with the PHPMailer to troubleshoot SMTP mail sending problems.

The PHPMailer is used in Nagios Fusion and Nagios XI for sending emails using SMTP. If your system is configured for Sendmail then this KB article does not apply to you.

 

Enable Debug Logging

To enable debug logging you need to edit the class.phpmailer.php file and define the following:

public $SMTPDebug = 2;

By default the value is set to 0.

The following commands will make that change for you:

Nagios Fusion

cd /usr/local/nagiosfusion/html/includes/utils/phpmailer/
sed -i 's/public \$SMTPDebug.*/public \$SMTPDebug = 2;/g' class.phpmailer.php

Nagios XI

cd /usr/local/nagiosxi/html/includes/phpmailer/
sed -i 's/public \$SMTPDebug.*/public \$SMTPDebug = 2;/g' class.phpmailer.php

 

Proceed to the next section to view the debug output.

 

View Debug Output

To view the debug output you need to send a test email.

Nagios Fusion

Open the Nagios Fusion web interface and navigate to Admin > System Configuration > Email Settings.

Click the Send a Test Email button which will then take you to the Test Email Settings page.

Here you need to click the Sent Test Email button.

 

Nagios XI

Open the Nagios XI web interface and navigate to Admin > System Config > Manage Email Settings.

Click the Send a Test Email button which will then take you to the Test Email Settings page.

Here you need to click the Sent Test Email button.

 

The output generated from the test will be placed as raw text at the top of the page, here is an example:

 

 

You can see in the screenshot above that there was an authentication issue. The output you see on your screen will be different and you can use that output to further troubleshoot your SMTP problems. Please refer to the following link for troubleshooting resources:

Troubleshooting PHPMailer Problems

 

 

Disable Debug Logging

When you no longer require the debug logging you will need to disable it by editing the class.phpmailer.php file and define the following:

public $SMTPDebug = 0;

 

The following commands will make that change for you:

Nagios Fusion

cd /usr/local/nagiosfusion/html/includes/utils/phpmailer/
sed -i 's/public \$SMTPDebug.*/public \$SMTPDebug = 0;/g' class.phpmailer.php

Nagios XI

cd /usr/local/nagiosxi/html/includes/phpmailer/
sed -i 's/public \$SMTPDebug.*/public \$SMTPDebug = 0;/g' class.phpmailer.php

 

 

Final Thoughts

For any support related questions please visit the Nagios Support Forums at:

http://support.nagios.com/forum/

0 (0)
Article Rating (No Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
Attachments Attachments
There are no attachments for this article.
Related Articles RSS Feed
Nagios XI - Common Upgrade Failures And Solutions
Viewed 2346 times since Thu, Jun 29, 2017
XI 5.4 monitoring engine not running
Viewed 4403 times since Mon, Feb 6, 2017
Nagios XI - SNMP MIB Upload Problems
Viewed 4406 times since Mon, Apr 10, 2017
Nagios XI - Scheduled Backup Log Level
Viewed 1828 times since Tue, Apr 18, 2017
Nagios XI - SNMPTT Service generates Cannot find module errors
Viewed 1950 times since Sun, Apr 9, 2017
NRPE - Agent and Plugin Explained
Viewed 12989 times since Fri, Jul 14, 2017
Nagios XI - Uploaded plugin returns "/bin/bash^M: bad interpreter: No such file or directory"
Viewed 3089 times since Thu, Feb 25, 2016
Nagios XI - Multi-Tech iSMS Integration
Viewed 2405 times since Thu, Jan 28, 2016
Nagios XI - Apply Configuration Never Completes
Viewed 10960 times since Tue, Jan 27, 2015
Nagios XI - Configuring Core Contacts to Use XI’s phpmailer SMTP Settings
Viewed 3217 times since Wed, Jan 27, 2016