By default, mailx will use a local MTA (usually sendmail) to transfer emails. If the machine you're using doesn't have sendmail, mailx will fail to send the email.

This can be resolved by specifying a mail server directly, in the case below, the SMTP server:

mail -s "subject" -S smtp=smtp:// ""

You can set the default SMTP server by defining it in /etc/mail.rc with the following line:

set smtp=smtp://