Mailx
is just a command-line tool to pass mail to your Mail Transfer Agent (MTA; whatever it is you have installed: sendmail, exim, ...). It does this by invoking the command sendmail (usually /usr/sbin/sendmail
). Your MTA provides this command to, well, send mail.
In your case, it tries to contact a server on the IPv6 address of the loopback device on localhost (::1
), and can't find anything. So either your MTA is not configured correctly (uses IPv6 instead of IPv4), or your IPv6 networking setup is not correct (no ::1 address on loopback interface).
The default from-address is your username, and the MTA adds whatever domain name you have configured in your MTA (and may further rewrite this according to various criteria like which mail server it contacts to deliver the mail, if you've set up rules for it).
You change these values by configuring your MTA.
I don't understand the question "what does mailx takes MTA address by default". If you mean "which MTA does it use", as I said, it just invokes the sendmail command, so it uses whatever MTA package you have installed that provides this command.