Reporting Module not sending mail

Hello Icinga Community,
I hope you all are well. I have configured the reporting module and all looks to be working well except the ‘send’ option. I click on the ‘send’ link to send the report by email but I never receive a email. Is there some logs for the reporting module I could review for errors on this problem? The normal Icinga problem alert emails are sent to my company SMTP server. I’m guessing I need to setup the reporting module emails the same way. How can I add SMTP server setting to the reporting module?

Thanks in advance for your help.
Alex

Hi,

the reporting module shouldn’t require any specific settings for email transmission, as it uses PHP’s mail functionality. Have you tried configuring PHP mail?

Hello Johannes,
Thanks for the reply, No, I have not configured PHP mail that I know of. PHP is installed with the default setting. How can I configure PHP mail? I did not see a requirement for this in the Reporting Module installation directions.

Regards
A

In php.ini. The settings are described in the PHP manual.

That’s not covered unfortunately.

Hello @nilmerg,
I hope you are well. I have added the SMTP setting in my php.ini file but the email is still not working. I have two php.ini files on my system and I have added the SMTP setting to both but the SMTP server name is not showing in the logs. Any help would be excellent. Sorry for my inexperience on php. :frowning: Please see the files below.

php -v 
PHP 5.6.33 (cli) (built: Feb 19 2018 14:53:27)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

/etc/php.ini

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtphostname.company.com
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = me@example.com

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = /usr/sbin/sendmail -t -i

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = On

; The path to a log file that will log all mail() calls. Log entries include
; the full path of the script, line number, To address and headers.
;mail.log =
/opt/rh/rh-php71/root/usr/bin/php -v
PHP 7.1.30 (cli) (built: Oct 29 2019 15:34:04) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies

/etc/opt/rh/rh-php71/php.ini

[mail function]
; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = /usr/sbin/sendmail -t -i

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail().
;mail.force_extra_parameters =
SMTP = smtphostname.company.com

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = On

; The path to a log file that will log all mail() calls. Log entries include
; the full path of the script, line number, To address and headers.
;mail.log =
; Log mail to syslog;
;mail.log = syslog

/var/log/mail.log

Jan 25 16:04:39 USDCXVDAS117 sendmail[10448]: 10PL4da3010448: Authentication-Warning: USDCXVDAS117.company.com: apache set sender to myname@company.com using -f
Jan 25 16:04:39 USDCXVDAS117 sendmail[10448]: 10PL4da3010448: from=myname@company.com, size=914, class=0, nrcpts=1, msgid=<202101252104.10PL4da3010448@USDCXVDAS117.company.com>, relay=apache@localhost
Jan 25 16:04:39 USDCXVDAS117 sendmail[10449]: 10PL4dDg010449: from=<myname@company.com>, size=1257, class=0, nrcpts=1, msgid=<202101252104.10PL4da3010448@USDCXVDAS117.company.com>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Jan 25 16:04:39 USDCXVDAS117 sendmail[10448]: 10PL4da3010448: to=myname@company.com, ctladdr=myname@company.com (48/48), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30914, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (10PL4dDg010449 Message accepted for delivery)
Jan 25 16:04:39 USDCXVDAS117 sendmail[10451]: 10PL4dDg010449: to=<myname@company.com>, delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=121257, relay=company.com. [10.157.91.177], dsn=4.0.0, stat=Deferred: Connection refused by company.com.

Regards
Alex

Well, php-mail is working, as can be seen in your mail.log. But your server is not accepting the mails. (Deferred: Connection refused by company.com.) You should probably ask a colleague or admin of yours why that’s the case.

Hello @nilmerg,
Thanks for your reply. I’ve sent an email to my gmail account for another test and it still did not work. See the logs below. It looks like the mail is getting to the gmail servers but timing out. Any ideas? The email address (icinga2-reports@company.com) I’m using for report is just a generic email account with no real mail box. Does this matter? I’m using a generic email account for the icinga2 problem emails without a problem.

Jan 26 16:35:02 USDCXVDAS117 sendmail[27292]: 10QLZ2lZ027292: Authentication-Warning: USDCXVDAS117.prod.company.com: apache set sender to icinga2-reports@company.com using -f
Jan 26 16:35:02 USDCXVDAS117 sendmail[27292]: 10QLZ2lZ027292: from=icinga2-reports@company.com, size=912, class=0, nrcpts=1, msgid=<202101262135.10QLZ2lZ027292@USDCXVDAS117.prod.company.com>, relay=apache@localhost
Jan 26 16:35:02 USDCXVDAS117 sendmail[27293]: 10QLZ2sb027293: from=<icinga2-reports@company.com>, size=1258, class=0, nrcpts=1, msgid=<202101262135.10QLZ2lZ027292@USDCXVDAS117.prod.company.com>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Jan 26 16:35:02 USDCXVDAS117 sendmail[27292]: 10QLZ2lZ027292: to=mymail@gmail.com, ctladdr=icinga2-reports@company.com (48/48), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30912, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (10QLZ2sb027293 Message accepted for delivery)
Jan 26 16:40:02 USDCXVDAS117 sendmail[27295]: 10QLZ2sb027293: to=<mymail@gmail.com>, delay=00:05:00, xdelay=00:05:00, mailer=esmtp, pri=121258, relay=alt4.gmail-smtp-in.l.google.com. [172.217.218.26], dsn=4.0.0, stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com.

Thanks in advance for your help.
Alex

Setting up mail transmission to the Internet requires many things to work correctly. I’m not an expert at this, you should probably ask in a new thread in Automation & Infrastructure - Icinga Community how to setup this and identify your server to services like gmail correctly so that you don’t end up identified as spammer.