I've been having a similar issue with Nagios sending out emails, when it sends them out I've been getting the email correctly to my email but I've also been getting delivery failure notifications with the below in them.
email@example.com, =@nagiosserver.domain.name, 0@,
Which is a malformed email because if you remove all of the @nagiosserver.domain.name you get
""@b, ***** nagios *****nnNotification Type:RECOVERYnnService: PINGnHost:XXXXXXXX RouternAddress: xx.xxx.x.xxxnState:OKnn Date/Time:Wed Feb, 16, 14:45:07, EST, 2011 nnAdditional Info:nn PING OK- Packetloss=0 RTA=89.33 ms
Which is the information sent in the alert command
/usr/bin/mailx "%b" "***** nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
In my research I found this thread and tried changing the commands as described at infosecprojects.net/nagios-sendmail.html
# NEW 'notify-service-by-email' command definition
command_line /usr/bin/printf "%b" "Subject:** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **\n***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\nnAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/sbin/sendmail $CONTACTEMAIL$
Today we had a server CPU go into the critical state. Nagios shows in the logs that it sent out emails to the correct people to let them know, but no one got any emails.
The issue with the malformed emails only started in the last week and had been running w/o issue for months up until now. I'm the only person who makes changes to the system and the only change I've made recently was to change the the email address for the nagios contact to my e-mail address and that was over a moth ago.
Currently on ones getting emails at all which isn't good, luckily nothing bad happened when the server CPU use reached critical today but I need to get emails working again A.S.A.P. and figure out why with the old command it both worked and didn't work at the same time.