HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
cancel
Showing results for 
Search instead for 
Did you mean: 

Colors

 
Manuales
Super Advisor

Colors

Hi, how can i put color to the output which will be sent to the outlook through email commando. look at:


mailx -s "date "+%Y%m%d"` " $correos < ${ruta_monitor}/${b}_m.log

${b}_m.log contains:
Cat
Dog
Chair
Computer


once the file has been sent (through email command) i need "Cat" be in red color and "Chair" in blue color showed once the user has been open their email notification.

how can i do that?

thanks in advance.
4 REPLIES
Torsten.
Acclaimed Contributor

Re: Colors

Mail must be in html format (for example) in order to be able to be formatted. So I would consider to add a full html body and tags.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Manuales
Super Advisor

Re: Colors

how could i do that?
how can i force to email command be sent as html ? and how could i put color ?
OldSchool
Honored Contributor

Re: Colors

basically, either you're log file would have to be formatted with html tags, or you would have to process it to add them prior to emailing. given your example & colors, at the minimum, the file being sent would need to look like this:


Cat




Dog

Chair




Computer


try pasting the above into notepad. save as demo2.html and then opening it. should pop Explorer and display.

you then send the file as an attachment. There may be other ways, but you're not going to be able to "colorize" the file without somekind of reformatting. By that, I mean that you can't send just plain-text and expect to get colors out the receiving end
Raj D.
Honored Contributor

Re: Colors

Manuales,

You can write the html file and attach with the mail,

Ex:
------unix_col_mail.html-------

unix_color_mail


Below TEXTs in Color


Cat

Dog

Chair







# ux2dos unix_col_mail.html | uuencode unix_col_mail.html | mailx -m -s "TEST. MAIL " youremail@domain.com < Text_body_file



- Also if the mail client can support direct html code display you can send it like:

# cat unix_col_mail.html | mailx -m -s "TEST. MAIL " youremail@domain.com


Hth,
Raj.


" If u think u can , If u think u cannot , - You are always Right . "