using colors in mailx

I want to use

notify_fail ()
{
echo " " >> ${MSG}
echo " Script failed n">> ${MSG}
cat ${MSG}|mailx -s "t1.ksh Success: "name@domain.com"
exit 1
}

I want script failed to show in Red or different colors in the email that i sent to name@domain.com

I serached several sites and also these forums a lot, could nt get the answer.
I tried using ^[[1m characters , but it doesnt work . Do we have to just type in or press control charchers plus some keys.. can someone plz help me.

This has been asked a number of times but basically there are two main forms of mail...

  1. simple text

  2. mime encoded html

unless you do something fancy, mailx will assume 1.

If you want colours, font attributes etc, then you need to send it as legal HTML and need to set the mime encoding to indicate such. This will then be illegable to people without HTML parsers in their mail clients.

If people are using small handhelds to receive these emails I advise against HTML, keep things simple.