How to fix the issue where you send an e-mail from within Linux, it is delivered to Gmail with "noname" attachment and contains no text.

I want the message to be text, not an "noname" file.

I found solution here.

turn:

cat somefile | mail -s "subject" [email protected]

into:

cat -v somefile | mail -s "subject" [email protected]

Code:
       -v, --show-nonprinting
              use ^ and M- notation, except for LFD and TAB
but what if i do not use cat?

This worked to get rid of noname attachment and show the output as e-mail text:

/bin/sh /path/to/script | tr -d \\r | mail -s "subject" [email protected]