Check the syntax. It should be
Code:
mailx -s "Scriptx was executed" root@localhost
then you're expected to type the text to include in the mail body and press Ctrl-D. If you want to put this in a shell script, you can use a "here document" like this
Code:
mailx -s "Scriptx was executed" root@localhost << EOT
some text here
some text here
some text here
EOT