Results 1 to 4 of 4

Thread: I want to send a html table in php mail .

  1. #1
    Join Date
    Aug 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post I want to send a html table in php mail .

    Hey guys,

    i m trying to send an order confirmation email to the customer along with the items ordered.
    here is the php code.
    $to = "$email";

    $from = "admin@peshawarirestaurant.co.cc";
    $subject = "Your Booking Information";
    //The Actual HTML Email Message to the customer

    $message = "
    <html>
    <head>
    <title></title>
    </head>
    <body>
    <p>Hi $firstname,\n\nThank you for Booking at peshawarirestaurant.co.cc!\n\n
    This email contains your Food order information.<br>
    For Your Booking No:$bookingno!</p>
    <table border=0 cellspacing=0 cellpadding=0 width= '500' align='center' >
    <tr>
    <th align=\"left\" >Item</th>
    <th>Price</th>
    <th > Quantitity </th>
    <th align=\"right\"> Sub Total</th>
    </tr>
    <tr>
    <td align=\"left\"> $name </td>
    <td align=\"center\"> $price </td>
    <td align=\"enter\">$quantity </td>
    <td align=\"enter\">£ $sub_total </td>
    </tr>
    <td ></td >
    <td ></td >
    <td ><b><br>Total =</b></td>
    <td align=\"center\"><b><br> £ $total </b></td>
    </tr>
    </table>
    </body>
    </html>
    ";

    // Always set content-type when sending HTML email
    $headers = "MIME-Version: 1.0" . "\r\n";
    $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";

    $headers = "From: peshawarirestaurant.co.cc";


    mail($to, $subject, $message, $headers);

    when the email is sent its just text with all the tages . No table is created.
    Any body can help please.

    regards

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Does the mail client your testing it with support html email? That looks correct to me. You might want to try removing the table and send a simple html message first like <span style="color:#ff0000;">RED</span>, with the html, head, body tags.
    Corrections to my coding/thoughts welcome.

  3. #3
    Join Date
    Jul 2010
    Location
    Minnesota
    Posts
    256
    Thanks
    1
    Thanked 21 Times in 21 Posts

    Default

    you are reasigning the the $headers variable rather than appending to it. Try changing this
    PHP Code:
    $headers "From: peshawarirestaurant.co.cc"
    to
    PHP Code:
    $headers .= "From: peshawarirestaurant.co.cc"

  4. #4
    Join Date
    Aug 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi bluewalrus and fastsol1,

    Thank you for ur kind replies.Have tried $headers .= "From: peshawarirestaurant.co.cc"; but didn't work .

    Regards

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •