I want an email to be sent in HTML and inside this email i need to pass data from php form. The email is sent successfully as an html email but it doesn't display data passed from PHP VARIABLE.
$name = "PHP TEXT";
$headers = "From: " ."[email protected]" . "\r\n";
$headers .= "Reply-To: ". "[email protected]" . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = "<html><body><h1>HTML TEXT <?php echo $name; ?></h1></body></html>";
$email_to = '[email protected]'; //the address to which the email will be sent
$subject = "test";
$email = "[email protected]";
if (mail($email_to, $subject, $message, $headers)) {
echo 'sent'; // success
} else {
echo 'failed'; // failure
}