I have some text in a file in UNIX. I send that file to my mail using
You would need to convert the contents to HTML, and ensure the header of the email includes
Content-Type: text/html; charset=UTF-8
How you would do this would depend on what program your "mail" command is, and indeed may not be possible. You could modify the script to inject the email into sendmail or similar instead by something like
echo 'Content-Type: text/html; charset=UTF-8 Subject: My Subject <html> <b>Email Header</b> <br /><br /> <font color="red">This text is red</font> </html>' | sendmail firstname.lastname@example.org
Note that this is a slightly crude implementation and may be more likely to dropped by spam filters unless tuned.
Some more background to davidgo's good answer:
Email standard did not start with colour or font supports. Thus there is no guarantee that the recipient can see any colour, no matter how hard you try.
Most clients however do interpreted mail a bit broader, and if you sent rich text or as webpage then it might render in colour. Alternatively, if you really need a specific markup you will need to send it as a picture (with all downsides, sunch as not being able to select text or edit).
Basic mail from a Unix like platform can be send as follows:
sendmail email@example.com < myfile
Or, if you like cat or start with a pipe:
cat myfile | sendmail firstname.lastname@example.org
Or, from echoing via shell:
echo 'content here' | sendmail email@example.com
All of these will send the contents of myfile, with no subject, no colour, no text markup. Just a plain simple mail. It is a good way to start with to understand the basics.
Now for David answer, it adds a line which tells the mailclient to treat the text as HTML ('Content-Type: text/html). Most mail client will happily recognise that. Some (such as elm which I still use to read suspicious emails) will not.
It also adds a subject which is quite user friendly.
And finally it uses HTML markup (start with
<HTML> and with
</HTML>, Bold tags, and font setting to set a colour. In this case red, but you can specify any colour with the "color="FF0000" format (in RGB, in this case maxed out red, no green, no blue).
If you have the need for a more complex, variable mail then a shell script can append parts to a file and you can use the first method ( sendmail user < input) to mail the final file.
The mail will be opened from Windows.
The mail client matters here. I expect thunderbird to render this just fine on windows as well on linux or BSD. Similar I expect mutt to fail, both on windows and on BSD's. Desgining a multipart mail with a text alternative might be a good idea. For this see RFC1341.