<?php
//Set anything you want to be dynamic in the email as {PARAM_NAME] then use the str_replace function to replace it with data from your code!
$UserEmail = "[USERS_EMAIL]";
$subject = "[SUBJECT]";
$htmlEmail = file_get_contents(__DIR__."/PATH/TO/EMAIL/TEMPLATE.html");
$htmlEmail = str_replace("{PARAM_IN_HTML_TEMPLATE}", $variable, $htmlEmail);
$headers = "From: [NAME] <[EMAIL_ADDRESS]>\n"; //From address
$headers .= "X-Sender: [NAME] <[EMAIL_ADDRESS]>\n"; //From address
$headers .= 'X-Mailer: PHP/' . phpversion(); //Mailer ID
$headers .= "X-Priority: 1\n"; // Urgent message!
$headers .= "Return-Path: [YOUR_EMAIL]\n"; // Return path for errors
$headers .= "MIME-Version: 1.0\r\n"; //MIME version
$headers .= "Content-Type: text/html; charset=iso-UTF-8\n"; //Content type
if(mail($UserEmail, $subject, $htmlEmail, $headers)) echo "sent Email!";
else echo "Didnt send email";
?>