I am using this script to send an HTML email
$to = '[email protected]';
$subject = 'Test Email';
$headers = "From: [email protected]\r\n";
$headers .= "Reply-To: [email protected]\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
$message = $htmlContent = file_get_contents("email_template.html");
mail($to, $subject, $message, $headers);
But I would like to add some variables like custom greeting with name etc. into the email. But I am not sure how to do that since I am using
$message = $htmlContent = file_get_contents("email_template.html");
To get the email content is because when I pasted the html content directly into the php code, the email got sent but the styling was broken for some reason...this way it works perfectly, but I don't know how to add variables.
Any help, please?
file_get_contents.