Using a specific mail implementation: s-nail (feature rich mail command), you have the -a switch especially designed to send attachments:
s-nail -s subject -a /path/to/file [email protected]
If you check man mailx, you will see that the -a is for adding headers, it could be confusing.
If you want something simple and reliable to send attachments ,then you are in the good way then here we go.
Add -v to have verbose output, and the progression of base64 operation on that file.
$ LANG=C apt-cache show s-nail
[...]
Homepage: https://www.sdaoden.eu/code.html
Description-en: feature-rich BSD mail(1)
S-nail is a mail processing system with a command syntax reminiscent
of ed(1) with lines replaced by messages. It is intended to provide
the functionality of the POSIX mailx(1) command and offers (mostly
optional) extensions for line editing, IDNA, MIME, S/MIME, SMTP and
POP3 (and IMAP). It is usable as a mail batch language. S-nail is a
derivative of Heirloom mailx, formerly known as nail, which
itself is based upon Berkeley Mail that has a history back to the 70s.