From the "MIME types" of the man page of mailx:
If there is a match with the extension of the file to attach, the
given type/subtype pair is used. Otherwise, or if the filename has no
extension, the content types text/plain or application/octet-stream
are used, the first for text or international text files, the second
for any file that contains formatting characters other than newlines
and horizontal tabulators.
If the log.txt file contains formatting characters other than newlines and horizontal tabulators, it's type will be recognized by
mailx as "application/octet-stream".
Again, from the man page of
-v, --show-nonprinting use ^ and M- notation, except for LFD and TAB
The trick is to add
cat's option to "show" the nonprinting characters as this:
cat -v log.txt | mail -s "Updated log file" -r "firstname.lastname@example.org" "email@example.com"
This works well for my testing.