There is no such concept as "bold text" in plain ASCII (aka text/plain
), which is what traditional clients such as mail
and its close relative mailx
send. If you compose text/enriched
(which never really took off) or another structured format like text/html
, text/rtf
etc then the facility is available, but the formatting codes to achieve it will most certainly not be the terminal control sequences you produce with tput
. These days, the simplest approach is probably to compose your message in HTML, and use a client which can properly set the Content-Type:
header to reflect this. (Some variants of mailx
apparently have this, but there are many incompatible ones which don't.)
So the following might work (source: https://stackoverflow.com/a/27693507/874188), if you're lucky and have a compatible mailx
version:
echo '<html><body><p>Test <b>bold</b> text</p></body></html>' |
mailx -a 'Content-Type: text/html' -s "Daily notification" 123@example.com
It would be nice if there was a universal formatting language which adapted and scaled to the facilities and conventions for terminals, print, and graphical displays in various form factors; at various times, Unix roff
, TeX, PostScript (which is still at the heart of PDF) and Microsoft's RTF have showed some promise, but none of them quite made it. Currently, HTML is the strongest contender in this field in my humble estimation, but still not quite there.
Meanwhile, some modern graphical email clients will display *bold*
as bold and _italics_
as italics even in plain-text messages; and even users who don't see this graphical markup can usually understand and appreciate these conventions.