For some reason my php mail() function does not send html,
Instead of <a href="mysite">link</a> it shows just shows link as plain text.
Any ideas?
this is the headers I used:
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
// Additional headers
$headers .= 'From: My Automated Message <[email protected]>' . "\r\n";
And invoked as follows:
try {
if (@mail($to_email, $subject, $message, $headers)){
echo "<span style=\"color:#0D0; font:10pt Tahoma;font-weight:bold;\">{$SENT_MESSAGE}</span><br><br>";
return true;
} else {
$tmp=error_get_last();
throw new Exception($tmp['message']);
}
} catch (Exception $e) {
echo "<span style=\"color:red; font:10pt Tahoma;font-weight:bold;\">Error: ".$e->getMessage()."</span><br><br>";
}
I also tried to send the mail without headers, but then again it shows the link as plain text like this: <a href="mysite">link</a>