Jump to content

html EMAIL


ecabrera

Recommended Posts

<?php

$msg = "";
$to = "[email protected]";
$email = $_POST['email'];
$subject = $_POST['subject'];
//$message = $_POST['message'];
$message = '<h1>TEST</h1>';
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: $email";

if(isset($_POST['submitbtn'])){
if($email){
	if($subject){
		if($message){

			mail($to,$subject,$message,$headers);
			$msg = "<font color='green'>Message Sent</font>";
		}else
			$msg = "Enter a message";
	}else
		$msg = "Enter a subject";
}else
	$msg = "Enter your email"; 
}

?>

Link to comment
https://forums.phpfreaks.com/topic/266690-html-email/#findComment-1366865
Share on other sites

Your script works to me:

Try this:

$to = "[email protected]";
$email = '[email protected]';
$subject = 'Post message';
$message = '
<html>
<head>
  <title>Birthday Reminders for August</title>
</head>
<body>
  <p>Here are the birthdays upcoming in August!</p>
  <table>
    <tr>
      <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
    </tr>
    <tr>
      <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
    </tr>
    <tr>
      <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
    </tr>
  </table>
</body>
</html>
';
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: ".$email;
if(mail($to,$subject,$message,$headers)){
   echo 'Message sent'; exit;
} else {
    echo "Error...."; exit; 
}

Link to comment
https://forums.phpfreaks.com/topic/266690-html-email/#findComment-1366870
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.