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
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
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:
Or, if you like cat or start with a pipe:
Or, from echoing via shell:
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
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 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.