Customize "From" email address


Anyone know how to customize the “From” email address of Nagios?


edit your /etc/passwd file for the user nagios.
Modify or insert whatever you want in the 5th field. i.e.
vi /etc/passwd


I’ve got the same issue, however I have what I want in the passwd file… just “Nagios”. All my pages show up nagios@ though. Any thoughts on how to modify what is sent out?


Yes, just do as I suggested. “vi /etc/passwd"
I’ve tried it and it works. email’s now state “From” Insteadof nagios@whatever”


Sorry, should have been more clear. I meant I’d like to get rid of the @whatever on my pages. I was figuring I’d have to add something to the notification command or reformat it someway? The from address takes up 3 lines on my pager.


This is what I get in my From field ""
But you might be referring to the subject field. If so, this is what I get in the subject field “** PROBLEM alert - FP CCI fpnd IO Virtual Server in AS400 Rm/Log_Layout8000_XML_file_processed is WARNING **”

And if so, then yes, it would take a few lines up on a pager.

Let us know which field, and we will see if we can help you out.


I already removed the subject field from my pages, that created a mess on the pager. Here’s my current command:

define command{
command_name notify-by-epager
command_line /usr/bin/printf “%b” “$NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nService: $SERVICEDESC$\nState: $SERVICESTATE$\nInfo: $SERVICEOUTPUT$” | /bin/mail $CONTACTPAGER$

It’s just defaulting to the host name from the email… since one is not specified anywhere?


If you want the From to be just “nagios” and not "" then do as instructed above.
Modify the 5th field and type in nagios.Like this:
vi /etc/passwd
I’ve tried it and it works. email’s now state “From nagios” Insteadof"

Edited Mon Apr 04 2005, 08:30PM ]



Is what was already there. My email alerts say “Nagios” But the pages just come up

I appreciate your fast responses… I can’t seem to get this forum to load that fast. I was just happy to find a Nagios forum.


here are the steps I’ve taken and the output I get in an email.
/etc/passwd looks like this:
5th field is empty
I login as nagios
su - nagios
I send an email to a valid account.
/usr/bin/printf “%b” “***** Nagios *****” | /bin/mail -s “alert”
This is what I get in the from field in the email.

Now, I edit /etc/passwd and make it like this:
I now run the same command:
/usr/bin/printf “%b” “***** Nagios *****” | /bin/mail -s “alert”
This is what I get in the from field in email:

But you say you already have only nagios in the 5th field?
Then what does your /etc/hosts file look like?
Mine is like this: localhost.localdomain localhost
xxx.xx.xx.xx tia2653

What is yours"


OK, perhaps you have configured sendmail to some method besides default.
What is the /etc/mail/ field that says "# my official domain name

… define this only if sendmail cannot automatically determine your domain

Ahh, wait a minute. That’s why mine says “from test” and not from "" because my sendmail can’t determine my domain name? But that doesn’t make sense, since if I leave the 5th field blank in my /etc/password file, then I get “from

Edited Mon Apr 04 2005, 09:12PM ]


try and edit the /etc/aliases file:
vi /etc/aliases

@(#)aliases 8.2 (Berkeley) 3/5/94

Aliases in this file will NOT be expanded in the header from

Mail, but WILL be visible over networks or from /bin/mail.

>>>>>>>>>> The program “newaliases” must be run after

>> NOTE >> this file is updated for any changes to

>>>>>>>>>> show through to sendmail.

nagios: nagios

Then run “newaliases”


Give Webmin a try, and use it to configure sendmail.

"If a local user tries to send email, sendmail will only allow the user to provide a different From: address if the user is on the list to the left. This restriction exists to prevent users from forging email with faked From: addresses origination from your system."
Quoted from “webmin” tool.
Edited Mon Apr 04 2005, 09:40PM ]


Well mail and sendmail are two different beasts… we even tried it manually just now through sendmail telling it From: and it still put the entire hostname in there. Then played with the host line, same thing. Tried the alias as well. I think I’m just gonna live with the long pages for now, and get back to it when it’s not such a chaotic day. Thanks man.


I worked on that all day, and I know for a fact, if I change position #5 in the /etc/passwd file to nagios, my mails from nagios only have “from nagios”, but can’t for the life of me explain why. It gave me a headache, so I had to quit, and really don’t have the drive to revisit the problem.


LOL, thanks for the valiant effort.