Reputation: 87
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.
Upvotes: 0
Views: 3195
Reputation: 12708
tput
is a command that uses terminfo(3)
(or termcap(3)
, depending on the system) to get the escape sequence that your interactive terminal uses to produce bold characters on output. That is not applicable to an email message, as the terminal on the receiver probably will not be the same (mostly won't, as normally people read email with graphical tools, not text based terminals anymore)
There is no concept of bold text in email. There is in HTML or other document formats (e.g. RTF, Word doc, Word docx, etc.) So the bold text will not appear as such in most of the mail readers (many of the text readers will avoid the escape sequences coming in the message, so they don't garble the actual text display)
Is it so important to focus on some part of the message, can you mark it with something less device dependent *****>>>>like this<<<<*****?
If you insist to send your personal terminal escape sequences to indicate a bold text, that doesn't appear as bold anywhere else in the world, you'll receive a lot of complaints from people that get their screens garbled by your messages. Worse if those are to be automatically sent.
Upvotes: 2
Reputation: 59566
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.
Upvotes: 0