Hi,
Iam writing a script in unix shell and need to edit the output (With colors and bold/italic/underline) and send as email. Can someone please help me on this requirement
Output as below. Need to know how to set this in echo command
Message Flow: messageflow1 //need to put this in red color
Execution Group: EG_mail2 //need to make this line bold font
Status: STOPPED
That highly depends on the capabilities of the receiving side. Will the mail be read using a mail client that understands/interprets HMTL text? Or just on a terminal capable of interpreting ECMA-48/ISO 6429/ANSI X3.64 terminal controls?
It might happe that outlook reckognized the txt extension and doesnt do html parsing on it.
Unless you only send the content of stoppedflow.txt, and not the whole file.
You'll have to add the appropriate mime header information. Without it no mail client I know of will treat the mail as html. Check if your mailx implementation supports the -a extension.
printf "<html><body>\n<font color=\"#ff0000\">Message Flow: %s</font><br><b>Execution Group: %s</b><br>Status: STOPPED\n</body></html>\n" $brokerflow $EG | \
mail -a "Content-Type: text/html" -s "`hostname` Alert!! Broker message flow is stopped" sample@xxx.com