Jump to content

Sending HTML email


petenaylor

Recommended Posts

Hi all

 

I am trying to create a HTML email that send using a PHP script. How do I open the quote and close the PHP tag so I can drop in my HTML code? You can see below my $message string starting and then I have tried to close the PHP tag.

 

<?php

$email = '[email protected]';
$to = '[email protected]';

$subject = "You have received an order from the Website ";

$message = ' '?>
<html>
<body>You have received an order from the Website.
<h1>Your Order Total:</h1>
<table width="726" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="331" height="39">JH001 AWD College Hoodie</td>
    
    <td width="107" align="left">small</td>
    
    <td width="40" align="center"><img src="http://www.testsite.com/images/shop/basket-logo-icon.gif" width="30" height="39" alt="You have chosen a logo for this item" /></td>
    
    <td width="40" align="center"><img src="http://www.testsite.com/images/shop/embroidery.png" width="30" alt="You have chosen embroidered text for this item" /></td>
    
    <td width="40" align="center"><img src="http://www.testsite.com/images/shop/basket-text-icon.gif" width="30" height="39" alt="You have chosen printed text for this item" /></td>
    
    <td width="40" align="center"><img src="http://www.testsite.com/images/shop/basket-number-icon.gif" width="30" height="39" alt="You have chosen a printed number for this item" /></td>
    
    <td width="40" align="center"><img src="http://www.testsite.com/images/shop/special1.gif" width="30" height="30" alt="You have chosen special offer 1 for this item" /></td>
    
    <td width="40" align="center"><img src="http://www.testsite.com/images/shop/special2.gif" width="30" height="30" alt="You have chosen special offer 2 for this item" /></td>
    
    <td width="48" align="center">£ 13.99</td>
    
  </tr>
</table>
</body>
</html>

<?php ' ';

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: ".$email."\n" . "Reply-To:  ".$email."\n";

// Mail it
mail($to, $subject, $message, $headers);

 

Many thanks for your help

Pete

Link to comment
https://forums.phpfreaks.com/topic/260897-sending-html-email/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.