Page 1 of 1
Return Address Name
Posted: Wed Mar 04, 2015 5:44 pm
by JohnFLi
I changed /etc/postfix/main.cf to reflect the @mydomain.com part of the from address. nice and easy
But how to I change the actual NAME of the email address??
currently the return address is
[email protected] but I want it to be
[email protected]
Any ideas?
(I am using sendmail)
Re: Return Address Name
Posted: Wed Mar 04, 2015 5:57 pm
by abrist
You could check the admin_email:
Code: Select all
grep "admin_" /usr/local/nagios/etc/nagios.cfg
Though I think you are seeing the linux user "nagios" as that is what user sent the email. You should be able to change the sender/return/from address in postfix.
Take a look at the following link, especially the mapping section:
http://semi-legitimate.com/blog/item/ho ... in-postfix
EDIT: If you were using the smtp php mailer in XI (requires that every contact be connected to a user), you could just set the sender in the UI (Admin --> Manage email settings)
Re: Return Address Name
Posted: Wed Mar 04, 2015 7:05 pm
by JohnFLi
Code: Select all
Take a look at the following link, especially the mapping section:
http://semi-legitimate.com/blog/item/ho ... in-postfix
Didn't work...... When I change teh email settings to use sendmail, it still sends as
[email protected], even though the address I have set there is different.
Re: Return Address Name
Posted: Thu Mar 05, 2015 10:09 am
by jdalrymple
Admin --> Manage E-mail settings
Worked for me ... using SMTP though.
I'll test with Sendmail.
--EDIT--
Sendmail worked too.
Re: Return Address Name
Posted: Thu Mar 05, 2015 11:21 am
by JohnFLi
good for you, happy to hear that.
But in all honesty, that doesn't help me.
When clicking on the 'test email', it does have the proper return address. The issue is when notifications are sent.
Re: Return Address Name
Posted: Thu Mar 05, 2015 12:45 pm
by tgriep
Can you post how your contact is defined in NagiosXI?
Go to the "Core Config Manager" > "Contacts" Click in the Floppy Icon for one of your contacts and post the config here.
Also, it is unclear on whether you are using postfix or sendmail as your email server, which one are you using?
Re: Return Address Name
Posted: Thu Mar 05, 2015 12:49 pm
by jdalrymple
Sorry about that, I used the same test method and achieved the same results, it worked. Like you though when the notification process ran it didn't work as we hope/expect.
The solution is easy enough though.
Configure --> CCM --> Commands --> notify-host-by-email, add the "-r" flag:
Code: Select all
/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -r [email protected] -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
Do the same for notify-service-by-email
Let us know if that doesn't solve it for you.
Re: Return Address Name
Posted: Thu Mar 05, 2015 1:09 pm
by JohnFLi
Outstanding, that worked!!!
I had seen the -r item before, but the places I've seen that had it at the end, not only did that not work, it actually made the address a CC of the email...
Thank you for your help.
Feel free to lock