To send HTML mail in PHP, you need to use some additional headers. Below is the code to send HTML mail in PHP.
$to = “recipient@domain.com“;
$subject= “Subject of email”;
$message= “This is <h1>HTML</h1> mail.”;
$fromName = “Name of the sender”;
$fromEmail = “sender@domain.com“;
// To send HTML mail, the Content-type header must be set
$headersĀ = “MIME-Version: 1.0″ . “\r\n”;
$headers .= “Content-type: text/html; charset=iso-8859-1″ . “\r\n”;
// Additional headers
$headers .=”From: $fromName <$fromEmail>”.”\r\n”;
//Mail function
mail($to, $subject, $message, $headers);