Jump to content

Sending email as HTML in PHP?!


jarv

Recommended Posts

Please help me, I am trying to send an email as HTML but I am getting an error:

Parse error: syntax error, unexpected T_VARIABLE in /home/fhlinux129/e/edisongray.com/user/htdocs/edisongray_webOCT/send-email-form.php on line 13

 

here is my code

<?php
// multiple recipients
$to = '[email protected]';
//define the subject of the email
$subject = 'Message from Edison Gray website';
	 $name = $_REQUEST['name'];
 $tel = $_REQUEST['tel'];
    $from = $_REQUEST['email'];
 $message1 = $_REQUEST['message']


// message
$message = '
<html>
<head>
  <title>$Subject</title>
</head>
<body>
  <p>$name</p>
  <table>
    <tr>
      <td>Telephone</td>
    </tr>
    <tr>
      <td>$tel</td>
    </tr>
  </table>
</body>
</html>
';

// 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";

// Additional headers
$headers .= 'To:' .$to. "\r\n";
$headers .= 'From:' .$from. "\r\n";


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

Link to comment
https://forums.phpfreaks.com/topic/218941-sending-email-as-html-in-php/
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.