Help with Script that sends out HTML emails

Sam Varshavchik mrsam at courier-mta.com
Fri Sep 16 01:02:43 UTC 2005


Ow Mun Heng writes:

> Hi,
> 
>         I'm writing a bash script that basically checks for stocks
> prices and I
> want the formatted output to be mailed to me. I've got the script
> working already. The only problem is the HTML is well, not displayed as
> HTML, it's displayed RAW(and not formatted).
> 
> I'm using cron to send the email out.
> 
> I've even put the echo statement :
> 
> html_header()
> {
>         echo "Content-Type: text/html; charset=iso-8859-1"
>         echo "<HTML><HEAD><TITLE>Stock Quotes :" $DATE "</TITLE></HEAD>"
>         echo '<STYLE TYPE="TEXT/CSS">'
>         echo "h1 {color: gray; border-bottom: 3px double silver}"
>         echo "h2,h3 {color: gray; border-bottom: 1px solid silver}"
>         echo "</STYLE></HEAD>"
>         echo "<BODY>"
>         echo "<H1>Stock Quotes :" $DATE "</H1>"
>         echo "<BR><BR>"
> }
> 
> 
> but all I get is :
> 
> Content-Type: text/html; charset=iso-8859-1
> <HTML><HEAD><TITLE>Stock Quotes : Fri Sep 16 06:52:02 2005
> </TITLE></HEAD>
> <STYLE TYPE="TEXT/CSS">
> h1 {color: gray; border-bottom: 3px double silver}
> h2,h3 {color: gray; border-bottom: 1px solid silver}
> </STYLE></HEAD>
> <BODY>
> <H1>Stock Quotes : Fri Sep 16 06:52:02 2005 </H1>
> <BR><BR>
> 
> What sort of "content-type" do I need to put into it? or do I have to
> format the message and use sendmail -t < quote

There are at least two structural problems with your message.

1) There is no blank line that separates mail headers from body.

2) The Mime-Version: header is missing.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20050915/776b3578/attachment-0001.sig>


More information about the fedora-list mailing list