test message is not sent

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
amintay
Posts: 16
Joined: Thu Dec 07, 2023 9:31 am

test message is not sent

Post by amintay »

Hi,
I have a problem when I want to send a test email on Nagios (linux centos) and I need your help .
I configured nagios to send notifications from my email address ****@gmail.com, The email settings are as follows:

Send From: ***@gmail.com
Send Method: SMTP with Basic Auth
SMTP Settings:
host : smtp.gmail.com
port : 587
username :****@gmail.com
password : "the same password for my gmail account"
Security: Tls

the error message is:

Mailer said: [12-13-2023 20:02:32] SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/ ... leshooting (method=smtp;host=smtp.gmail.com;port=587;smtpauth=true;security=tls), Referer: admin/testemail.php
An error occurred sending a test email!


thanks
User avatar
danderson
Posts: 234
Joined: Wed Aug 09, 2023 10:05 am

Re: test message is not sent

Post by danderson »

Thanks for reaching out @amintay,

I would reference this article here to debug further.
https://support.nagios.com/kb/article.php?id=820

When I set mine up to replicate the issue, I got an invalid second factor error. I would think this changes based on your configuration.
amintay
Posts: 16
Joined: Thu Dec 07, 2023 9:31 am

Re: test message is not sent

Post by amintay »

First of all, thank you for your comment.
I did the manipulation described in the link, but I cannot get the debugging :!: :!: :!: :!: :!: :!:
If you have any other leads I would be grateful.
here are the two screenshots
You do not have the required permissions to view the files attached to this post.
User avatar
danderson
Posts: 234
Joined: Wed Aug 09, 2023 10:05 am

Re: test message is not sent

Post by danderson »

There should also be a commented out line around line 195 in /usr/local/nagiosxi/html/includes/utils-email.inc.php

Code: Select all

// Debugging
// $mail->SMTPDebug = 4; // full debug
to

Code: Select all

// Debugging
$mail->SMTPDebug = 4; // full debug
amintay
Posts: 16
Joined: Thu Dec 07, 2023 9:31 am

Re: test message is not sent

Post by amintay »

Hi ANDERSON,

I followed this procedure and it worked. I got the logs.
after the analysis, I was able to identify the problem and it was solved.

thank you very much :) :) :)
onsccwg833
Posts: 2
Joined: Tue Dec 26, 2023 9:54 pm

Re: test message is not sent

Post by onsccwg833 »

It seems like you've configured Nagios on CentOS to send notifications via email using your Gmail account but are encountering issues. Here are a few steps and considerations to help troubleshoot the problem:

Check Network Connectivity:

Ensure that your CentOS server has internet access and can reach smtp.gmail.com on port 587.
Verify Gmail Account Credentials:

Double-check that the username and password provided for your Gmail account are accurate. Also, ensure that your Gmail account allows less secure apps to access it. You may need to enable "Allow less secure apps" in your Gmail account settings.
Firewall Configuration:

Verify that your firewall allows outgoing connections on port 587. If a firewall is active, open the necessary port for SMTP communication. slope game
amintay
Posts: 16
Joined: Thu Dec 07, 2023 9:31 am

Re: test message is not sent

Post by amintay »

thank you, problem solved
Locked