This question already has an answer here:
I have tried to send an email from PHP with the next body:
$message .= 'This is a simple message';
$message .= "
";
$message .= 'http://www.yahoo.com';
$message .= "
";
$message .= "<a href='https://www.google.com'>Google</a>";
$message .= "
";
As a result I got the next output:
This is a simple message //This line is ok
http://www.yahoo.com //This line is ok
<a href='https://www.google.com'>Google</a> //It should appear the word Google clickable but it does not
Instead of having the word Google with the link clickable to the Google site I get the html code, how could I fix this? Thanks
</div>
I'm not sure, haven't tried it but maybe try:
$message .= '<a href="https://www.google.com">Google</a>';
NOTE: added double quotes in href link
You need to be sure you're sending mail as HTML and not as text/plain that is probably in your case so you get HTML as source code and not as it should look like.
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "
";
$headers .= "Content-type:text/html;charset=UTF-8" . "
";
more read here: