Font change in unix while sending email

Hi,

I know that we would be require HTML to change the font and color of the text of the output, if we wnt to send that through the email.
But I have managed to get below code, can someone look into it and let me know if i can acheive my requirement through this kind of code:

Following can be used:

###################
## "style sheet" ##
 
my $ss_header = $mw -> fontCreate( -family => "Courier", -size => "14", -weight => "bold" );
my $ss_results_body = $mw->fontCreate(
-family => "screen",
-size => 12,
-weight => "normal"
);

Not sure, how to use above code in my script to change the font of the text to display in bold in the email. Any help on this would be much appreciated.

Thanks
Amit

---------- Post updated at 09:35 PM ---------- Previous update was at 05:27 PM ----------

Any one for help here?

I guess it depends on the mail client. Is it html email or ???

If I wanted to send HTML email from the UNIX command batch world, I might write my own SMTP client, stealing my content clues from an HTML email saved as a flat file. SMTP is easy to do, using "telnet <mail_host> 25" or the equivalent. Maybe there is an HTML email client out there that can run in batch.

No Not html email.
It is just a plain text email.
Now any inputs?

Plain text is not bold, underlined, italic and has no color. You need rtf or html or the like to tune up your text. Man pages and old nroff/troff programs used to send backspace and repeat the character (sometime many times), which works somewhat on paper, but does nothing for a CRT.

$ man man|cat -vt|head
 
 m^Hm^Hm^Hma^Ha^Ha^Han^Hn^Hn^Hn(^H(^H(^H(1^H1^H1^H1)^H)^H)^H)                                                               m^Hm^Hm^Hma^Ha^Ha^Han^Hn^Hn^Hn(^H(^H(^H(1^H1^H1^H1)^H)^H)^H)
 
 
 N^HN^HN^HNA^HA^HA^HAM^HM^HM^HME^HE^HE^HE
      man - find manual information by keywords; print out a manual entry

Your email doesn't need to look like a web page if you use simple font tags in the email it can appear just like you want, try playing around with an on-line html editor and see if you can get a message format you like.

Eg:

 $ sendmail someone@fake.address.com <<EOF
To: someone@fake.address.com
Subject: Text message
Content-Type: text/html; charset="us-ascii"
<html>
<body>
<p>
<font size="5" face="Courier" color="blue">
This is a header
</font>
</p>
<font size="2" face="screen">
And some normal paragraph text.
</font>
</p>
</body>
</html>
EOF

This should look like this in the email:

This is a header
And some normal paragraph text.

how can i connect this HTML code with my unix script?
Can i write this code in my unix script?
I am using mail -s command to send an email to mailbox.

Yes, to get past into the headers usually means leaving mail behind. You might be able to set the content type to html in "mail -s" or "mailx -s" by putting a linefeed after the subject and then any header lines you want. I have kludged mailx this way for priority on Solaris (where mail has no -s). Otherwise, using sendmail, or telnet to a server, allows you to send the raw mail formats.

cat file.csv | mail -s "test" example@example.com

can u gimme an example here.....
above is the command I am using, now how I can add HTML content.

Can you give us some details of what is in file.csv, is it really a Comma-separated values file?

Do you want the headings bold, formatted like a table, or what?

Basically, what we would do is process the .csv file with and awk script that formatted it how you want and then pass it on to sendmail.

awk '....some formatting here...' file.csv | sendmail example@example.com

Have a go with my previous example and just change the email address to your address to see what we are talking about.

Try something like this:

mails -s 'My Subject
Content-type: text/html' my_recipients <my_file.html