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 = 'do-not-reply@test.co.uk';
$to = 'mail@petenaylor.net';

$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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.