Yes, it is possible. The HTML content type to be added to the mail header (as parameter to the function mail() ).
The following code snippet depicts the possibility.
mail($recipientAddress, $subject, $messageToSend, From : $senderAddress Content-type text/html; charset = iso-8859-1);
‘example@example.com'
// subject
$subject = 'HTML email';
// message
$message = '
<html>
<head>
<title>HTML EMAIL</title>
</head>
<body>
<p>Sample of HTML EMAIL!</p>
</body>
</html>
';
// 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 .= 'To: Joe <joe@example.com>, Kelly <kelly@example.com>' . "\r\n";
$headers .= 'From: HTML EMAIL <sample@example.com>' . "\r\n";
$headers .= 'Cc: samplecc@example.com' . "\r\n";
// Mail it
mail($to, $subject, $message, $headers);
?>
No comments:
Post a Comment