sending html email using php not working -
trying sending html email using php mail function. below code using.
public function sendactivationmail($activationcode="",$receiveremail=""){ $subject="registration confirmation"; $body="<html><body>"; $body.="<p>thank registering us. please activate account clicking 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: abc@gmail.com'."\r\n".'reply-to: abc@gmail.com'."\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 checked email html tags appears text don't know why?
you need use
$headers .= "content-type: text/html; charset=iso-8859-1\r\n";
*-type in camelcase
Comments
Post a Comment