The reason it was not working the same as the command line is because mailx expects inputs from the standard input (interactive) when invoked; the echo command creates a null line which gets passed to the standard input of mailx.
Yes I have a server configured that constantly probes another one (its called from within cron every 5 minutes) I configured a script to use the cu command ( do a man on cu) I will have to post parts of the script later - its on another machine that I cannot reach right now.
nothing wrong with me that a few lines of code cannot fix!