Bobcares

How to Enable Debug Logging with PHPMailer in Nagios

by | Mar 8, 2022

Enable Debug Logging with PHPMailer in Nagios with a little assistance from our in-house experts. 

At Bobcares, we offer solutions for every query, big and small, as a part of our Server Management Services.

Let’s take a look at how our Support Team is ready to help customers enable Debug Logging with PHPMailer in Nagios.

All About Debug Logging with PHPMailer in Nagios

The PHPMailer sends emails via SMTP in Nagios Fusion as well as Nagios XI. Today, our Support Team is going to take us through enabling debug logging with the PHPMailer in order to troubleshoot any SMTP mail sending problems we may be facing.

In fact, our Support Engineers helped out a customer recently with the same issue.

How to Enable Debug Logging with PHPMailer in Nagios

According to our skilled Support Techs, we have to edit the class.phpmailer.php file as seen below:

public $SMTPDebug = 4;

This value is set to 0 by default. We can make this change with the help of the following commands:

For Nagios Fusion:

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

For Nagio XI:

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

How to View Debug Update

Additionally, we can view the debug output by sending a test email.

For Nagios Fusion:

  1. First, log in to the Nagios Fusion web interface.
  2. Then, head to Admin > System Configuration > Email Settings.
  3. Next, click Send a Test Email button to head to the Test Email Settings page.
  4. Finally, click the Sent Test Email.

For Nagios XI:

  1. First, log in to the Nagios XI web interface.
  2. Then, head to Admin > System Configuration > Manage Email Settings.

    Enable Debug Logging with PHPMailer in Nagios

  3. Next, click Send a Test Email button to head to the Test Email Settings page.
  4. Finally, click the Sent Test Email.

The output of these steps will result in the raw text at the top of the page. Furthermore, we can use this to troubleshoot SMTP problems.

How to Disable Debug Logging

Once we no longer require the debug logging feature, we can disable it by editing the class.phpmailer.php file as seen below:

public $SMTPDebug = 0;

We can make this change with the help of the following commands:

For Nagios Fusion:

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

For Nagios XI:

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

[Looking for a solution to another query? We are just a click away.]

Conclusion

In brief, our skilled Support Engineers at Bobcares demonstrated how to enable Debug Logging with PHPMailer in Nagios.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.