Page 1 of 1

test message is not sent

Posted: Wed Dec 13, 2023 2:05 pm
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

Re: test message is not sent

Posted: Wed Dec 13, 2023 3:00 pm
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.

Re: test message is not sent

Posted: Wed Dec 13, 2023 3:47 pm
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

Re: test message is not sent

Posted: Thu Dec 14, 2023 11:07 am
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

Re: test message is not sent

Posted: Thu Dec 14, 2023 4:17 pm
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 :) :) :)

Re: test message is not sent

Posted: Tue Dec 26, 2023 9:57 pm
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

Re: test message is not sent

Posted: Wed Dec 27, 2023 5:25 am
by amintay
thank you, problem solved