Gmail Account for Email Alerts

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Hugo
Posts: 7
Joined: Thu Nov 21, 2013 8:01 pm

Gmail Account for Email Alerts

Post by Hugo »

Hi everyone,

I cannot seem to get a gmail account working to send email logs with. I have tried a normal pop account and it works fine.

Sendmail says it works but nothing comes through
SMTP says the below

A test email was sent to [email protected]
----
Mailer said: SMTP Error: Could not connect to SMTP host. (method=smtp;host=smtp.gmail.com;port=465;smtpauth=true;security=ssl)
An error occurred sending a test email!


I have tried SSL, TLS and none. I have also enabled "Less Secure Apps" within the gmail account.

Is there something i'm missing?
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Gmail Account for Email Alerts

Post by dwhitfield »

Can you post a screenshot of your SMTP settings, censoring out any sensitive information?

Also, can you send another test email then immediately run tail -n20 /var/log/httpd/error_log from the command line and post the results?
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Gmail Account for Email Alerts

Post by tgriep »

Also, can you run these commands and post the output so we can see the errors when an email is being sent from your server?

Code: Select all

tail -50 /var/log/maillog
tail -50 /usr/local/nagiosxi/tmp/phpmailer.log
Be sure to check out our Knowledgebase for helpful articles and solutions!
Hugo
Posts: 7
Joined: Thu Nov 21, 2013 8:01 pm

Re: Gmail Account for Email Alerts

Post by Hugo »

Below is my settings
Image

Ok so I have just tested sending the alerts to another GMail account and it works fine.(except is going to junk)

Were using Symantec.cloud's spam protection for our exchange server and I'm going to use it to try find a trace of the message. (have added the address as an whitelisted sender in Symantec.cloud as well as exchange)

the destination address has not changed. we were using the ISP's POP account to send alerts but changed ISP's and have issues getting a gmail account to work.
Hugo
Posts: 7
Joined: Thu Nov 21, 2013 8:01 pm

Re: Gmail Account for Email Alerts

Post by Hugo »

Ok so weird things

according to /var/log/maillog it seems to be trying to connect to our domain.com:25 and matching to our public IP. however that's the website host. its not looking up the MX records for domain.com


Image

phpmailer.log
Image
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Gmail Account for Email Alerts

Post by tgriep »

Your mail method settings for XI are using the Sendmail so we only need to concern ourselves the the errors in the /var/log/maillog file.
The php log is for if you are using the SMTP Mail Method.

It looks like the XI server cannot connect to the mail host, so can you verify that the XI server can Ping the mail host and that it is allowed to relay email through it?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Hugo
Posts: 7
Joined: Thu Nov 21, 2013 8:01 pm

Re: Gmail Account for Email Alerts

Post by Hugo »

Hi,

yes it can ping smtp.gmail.com no problem.
its weird i can send to another gmail account just not our exchange server (obviously all other exchange mail flows fine)
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Gmail Account for Email Alerts

Post by tgriep »

If the Nagios server cannot use your exchange server to relay emails as it is being blocked, you will have to have someone allow the Nagios server to relay through it.
Be sure to check out our Knowledgebase for helpful articles and solutions!
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: Gmail Account for Email Alerts

Post by avandemore »

Hi Hugo,

It's not entirely clear to me what email process you are trying to invoke.

In Nagios XI > Admin > Manage Email Settings, Sendmail should be chosen if you want an MTA on your local box to deliver the message(or is configured to relay it). SMTP should be chosen if you want an external SMTP server to relay the message in your case gmail?. In the latter scenario, the message will arrive to the contact's email address as from the smtp account used to login to gmail.

If you want the email to simply be delivered to a gmail address, chose Sendmail and change the contact's email to the gmail address.
Previous Nagios employee
Hugo
Posts: 7
Joined: Thu Nov 21, 2013 8:01 pm

Re: Gmail Account for Email Alerts

Post by Hugo »

Thanks avandemore, that clears things up.

in that case I do want to use SMTP.
however SMTP gives me the following error

"A test email was sent to [email protected]
----
Mailer said: [10-10-2016 08:30:17] SMTP Error: Could not connect to SMTP host. (method=smtp;host=smtp.gmail.com;port=465;smtpauth=true;security=ssl), Referer: admin/testemail.php
An error occurred sending a test email!"

like mentioned earlier the nagiosxi server can ping smtp.gmail.com no problem.
Locked