"mailx" setup question

firstly, i apologise if this is in the wrong place, i would appreciate it if a moderator can move it to a more appropriate location.

I read the man pages for/usr/bin/mail and /usr/bin/mailx and but they didn’t really help. I read somewhere in them that I need to create a .mailrc file in my home directory which I did as below:-

account myaccount{
set smtp=192.168.100.2
}

i then tried to send a test email using the command:-

mailx -s “test” -r "[email protected]" recipient.address@targ****etdomain.com -a myaccount

upon pressing enter, i could type things (i presume the email body?) and pressing control-d returned “EOT” and back to the command prompt.

The recipient however, did not get an email.

Naturally, I need to configure something somewhere so that nagios will send an email notificiation out to the contacts etc.

I am on a LAN, the mailserver (exchange) is at 192.168.100.2 (it supports pop3/smtp), I guess i need to edit the .mailrc fie some more but i have never used it before so I’m stuck hehe.

Please help!!!

Hello again
Sorted it (sort of!)

  1. edited the .mailrc file to:-
    **
    account myaccount{
    set record=+Sent
    set from="[email protected] (Nagios Admin)"
    set smtp=192.168.100.2
    }
    **

  2. changed the command line to
    printf “Message Body Text” | mailx -send -A myaccount -s “Email subject” reci****[email protected]

and now, I get emails from the command line :smiley:
[size=125]
The only problem I have now is specific to Nagios, which is how do I get emails working from within the program? The .mailrc file has to be in the “home” folder of the user who is wishing to send emails via mailx; there is no nagiosadmin user on the system - does it use root or do I have to create local users for each nagios user (as defined in my /usr/local/nagios/etc/htpasswd.users file)?[/size]