<?php
$to = 'user@example.com';
$subject = "Send HTML Email Using PHP";
$htmlContent = '
<html>
<body>
<h1>Send HTML Email Using PHP</h1>
<p>This is a HTMl email using PHP by CodexWorld</p>
</body>
</html>';
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From: CodexWorld<info@codexworld.com>' . "\r\n";
$headers .= 'Cc: welcome@example.com' . "\r\n";
$headers .= 'Bcc: welcome2@example.com' . "\r\n";
if(mail($to,$subject,$htmlContent,$headers)):
$successMsg = 'Email has sent successfully.';
else:
$errorMsg = 'Email sending fail.';
endif;
?>