in reply to Using system with mailx

I can't say if mailx do that, but some programs check if they are executed by human (or rather if the input is a tty). You might check the output of the mailx program by running it in backtics instead of system.