I am trying to sending an html email by using the php mail function. Below is the code that i am using.
public function sendActivationMail($activationCode="",$receiverEmail=""){
$subject="Registration Confirmation";
$body="<html><body>";
$body.="<p>Thank you for registering with us. Please Activate your account by clicking the activation link ";
$body.="<a href=".$this->url()->fromRoute('Login/default',array('controller'=>'Index','action'=>'activation','id'=>'abc121')).">Activate</a></p>";
$body.="</body></html>";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1'."\r\n";
$headers .= 'From: [email protected]'."\r\n".'Reply-To: [email protected]'."\r\n" .'X-Mailer: PHP/' . phpversion();
$status=mail($receiverEmail,$subject,$body,$headers);
if($status){
return true;
}else{
echo "Error in sending mail";
exit();
}
}
But when i checked email then html tags appears as a text i don't know why?