Issue
I want to make text bold and send that output using SMTP as mail.
Mail configuration is done properly and i am getting mail.
But i am getting a .bin
file instead of the printed line.
Please help me with this.
This is my code to make the text bold
bold=$(tput bold)
normal=$(tput sgr0)
echo "this is ${bold}bold${normal} but this isn't" > test.txt
cat test.txt | mailx -vvv -r "[email protected]" -S smtp="xx.xxx.xxx.xx" [email protected]
this is bold(in bold) but this isn't".
This as a mail notification.
Solution
If you add escape sequences (like produced by tput bold
) into a text and send that via mailx
or similar, the mail program might figure out that the text you send is not pure ASCII and deduce that this is probably a binary file.
As a result, the file is sent as a binary part of the mail.
Answered By - Alfe Answer Checked By - David Marino (WPSolving Volunteer)