Based on PR 38262, some portability improvement and ipv6 support optionify.
mailx (Heirloom Mailx; formerly nail) is a mail user agent derived from
Berkeley Mail 8.1. It is intended to provide the functionality of the
POSIX.2 mailx command with built-in support for MIME messages. This means
it can handle international character sets as well as attachments. In
recent system environments, nail is Unicode/UTF-8 capable. It further
contains some minor enhancements like the ability to set a "From:" Address.