I want to send an email via PHP in HTML format the code shown below gives me the next problem: The mailscript is actually working but when the mail arrives and I open it the mail is displayed in html code. I actually want to make the HTML code work in the mail.
<?php
$headers = "From: " . strip_tags($_POST['emailadres']) . "
";
$headers .= "Reply-To: ". strip_tags($to) . "
";
$headers .= "CC: ".$to."
";
$headers .= "MIME-Version: 1.0
";
$headers .= "Content-Type: text/html; charset=ISO-8859-1
";
$message = '<html><body>';
$message .= '<img src="//css-tricks.com/examples/WebsiteChangeRequestForm/images/wcrf-header.png" alt="Website Change Request" />';
$message .= '<table rules="all" style="border-color: #666;" cellpadding="10">';
$message .= "<tr style='background: #eee;'><td><strong>Name:</strong> </td><td>" . strip_tags($_POST['voornaam']) . "</td></tr>";
$message .= "<tr>
<td>
Vraagsteller
</td>
<td>
".$_POST['voornaam']."
</td>
</tr>";
$message .= "<tr>
<td>
From
</td>
<td>
".$from."
</td>
</tr>";
$message .= "<tr>
<td>
Titel
</td>
<td>
".$subject."
</td>
</tr>";
$message .= "<tr>
<td>
Activatie link
</td>
<td>
Link
</a>
</td>
</tr>";
$message .= "<tr>
<td>
Privacy
</td>
<td>
".checkPrive()."
</td>
</tr>";
?>
Try this
$to="abc@domain.com";
// Your subject
$subject="$sub";
// From
$from = "xyz@domain.com";
$headers = "MIME-Version: 1.0
";
$headers .= "Content-type: text/html; charset=iso-8859-1
";
$headers .= "From: <".$from.">
";
$headers .= "CC: cc@domain.com
";
$headers .= "X-Priority: 1
";
// Your message
$message= $text;
$send=mail($to,$subject,$message,$headers);