Email problem

Posted on 2006-05-07
Last Modified: 2006-11-18
For some reason on the HTML email I am sending is working perfectly but it is not recognising the external links

<link rel='stylesheet' href='' type='text/css'> - the emal content does not follow the css standards set for it

<input class='btn' onMouseOver=this.className='btn btnhov' onMouseOut=this.className='btn' type='button' value='download' onClick=window.location='$prod_file'>

- the download button is not working as it is trying to invoke an external link

The code is as under

$to  = $billing_email . ", " ;
$subject = "REITS Group LLC - Order Confirmation";
$mssg = <<< EOM
<link rel='stylesheet' href='' type='text/css'>
<table width="700" border="0" cellspacing="0" cellpadding="1">
<td bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<td width="4%" bgcolor="#990000" class="whitebold">&nbsp;</td>
<td bgcolor="#CC0000" class="whitebold">Order Summary</td>
<tr bgcolor="#EBEBEB">
<td bgcolor="#E2E2E2">&nbsp;</td>
<td valign="top" bgcolor="#EBEBEB">
<table width='100%' border='0' cellspacing='0' cellpadding='10'>
<td bgcolor='#DBE1FC' class=text>Thank you for your order! </strong><br><br>
<strong>Transaction Number: </strong>$order_id<br>
<strong>Transaction Date:</strong> $order_date<br>
<strong>Amount Charged:</strong> $ $total_amt<br>
<strong>Credit Card:</strong> Visa (ending in 6488)<br>
<td bgcolor='#DBE1FC'>
<table width='100%' border='0' cellspacing='0' cellpadding='2'>
<td bgcolor='#999999'>
<table width='100%' border='0' cellpadding='6' cellspacing='1' bgcolor='#FFFFFF'>
<tr bgcolor='#FFFFFF'>
<td align='center' class=text>Product</td>
<td width='15%' align='center'></td>
<td width='11%' align='center' class=text>Quantity</td>
<td width='12%' align='center' class=text>Subtotal</td>

while ($row = mysql_fetch_row($presult))     {
$prod_nmprice = $prod_nmprice * $cart_qty;
$prod_nmprice = number_format($prod_nmprice, 2);
$total += $prod_nmprice;
$total = number_format($total, 2);
$isql="INSERT INTO items (order_id,prod_id,prod_name,prod_qty,prod_price) VALUES ( '$order_id','$prod_id','$prod_name','$cart_qty','$prod_nmprice')";
$iresult = mysql_query($isql);

$mssg .= <<< EOM
<tr bgcolor='#EBEBEB'>
<td class=text><strong>$prod_name</strong></td>
<td align='center'><input class='btn' onMouseOver=this.className='btn btnhov' onMouseOut=this.className='btn' type='button' value='download' onClick=window.location='$prod_file'></td>
<td align='center' class=text>$cart_qty</td>
<td align='center' class=text>$ $prod_nmprice</td>

$mssg .= <<< EOM
<tr bgcolor='#FFFFFF'>
<td colspan='3' align='right'> <strong>ORDER TOTAL:</strong></td>
<td align='center'>$ $total</td>
<table width="100%" border="0" cellpadding="6" cellspacing="0">
<tr bgcolor="#CCCCCC">
<td nowrap class="text"></td>

$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

$headers .= "From:\r\n";
$headers .= "Reply-To:\r\n";

mail($to, $subject, $mssg, $headers);
Question by:sulentho
    LVL 17

    Expert Comment

    Not a solution but instead a suggestion:
    Try including the CSS right into the html.
    <style type="text/css">
    /* CSS CODE HERE */

    If that works then you have isolated the problem to the <link>.
    Joe P

    Author Comment

    I included the css inisde the code but still the email generated does not obey the css does anyone know the reason why. Thanks
    LVL 17

    Accepted Solution

    I don't know why that is, maybe your email client?

    Check out this link:

    It says: <style></style> works in yahoo and windows live but not in hotmail and gmail.
    The <link> does not work in ANY of them.
    But <link> will work in any application link: Outlook 2003/OE, AOL 9, Lotus Notes, and Thunderbird            

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
    Part of the Global Positioning System A geocode ( is the major subset of a GPS coordinate (, the other parts being the altitude and t…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now