Page 1 of 1

Customise email notifications

Posted: Mon Mar 12, 2018 1:20 am
by McHenry
I have email notifications for warning and critical situations and it works well.

I would like to customise these notifications where possible starting with the sender address.

Presently all emails received originate from: nagios@localhost.localdomain
I would like the emails to be sent from: myserver@mydomain.com

I thought the networking config was set correctly as per below however the hosts file still has the default settings.

[root@myserver ~]# hostname
myserver.mydomain.com
[root@myserver ~]#
[root@myserver ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
[root@myserver ~]#

Re: Customise email notifications

Posted: Mon Mar 12, 2018 8:55 am
by mcapra
Can you share the command definition(s) you are currently using for your notification commands?

The answer to this depends on which mail client you're using as well as some things on the mail server side. Here's how to set the "sender" address if you're using mailx:
https://stackoverflow.com/questions/129 ... lx-command

Re: Customise email notifications

Posted: Tue Mar 13, 2018 11:25 am
by kyang
Thanks for the help @mcapra!