Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

send email template via php

<?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>';

// Set content-type header for sending HTML email
$headers = "MIME-Version: 1.0" . "
";
$headers .= "Content-type:text/html;charset=UTF-8" . "
";

// Additional headers
$headers .= 'From: CodexWorld<info@codexworld.com>' . "
";
$headers .= 'Cc: welcome@example.com' . "
";
$headers .= 'Bcc: welcome2@example.com' . "
";

// Send email
if(mail($to,$subject,$htmlContent,$headers)):
    $successMsg = 'Email has sent successfully.';
else:
    $errorMsg = 'Email sending fail.';
endif;
?>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #send #email #template #php
ADD COMMENT
Topic
Name
4+5 =