I'm attempting to send webinar confirmation emails using PHP, however I want to have the email content be stored in a separate file on my server. I have figured out how to do this, however I have no idea how to pass variables to the separate HTML file.
Here is my PHP for email sending:
$from = "no-reply@thelaunchpadsoceity.com";
$to = $email;
$subject = "You Are In!";
//LINK TO SEPARATE HTML DOCUMENT THAT CONTAINS RESPONSIVE EMAIL FORMATTING
$message = file_get_contents('./webinar_emails/registration_confirmed.html');
$headers = "From: " . $from . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
mail($to,$subject,$message, $headers);
Is there a way I can pass variables such as the users first name, or the registration time of the webinar to the separate HTML file for display, and then email all those details to the user?
My separate email registration HTML file can be found here.
I would like to put variables in the following sections of code:
<span style="font-size: 26px; line-height: 31px;">YOUR WEBINAR INFORMATION IS AS FOLLOWS:</span></p>
<p style="margin: 0;font-size: 12px;line-height: 14px;text-align: left">
<strong>
//ENTER VARIABLE FOR WEBINAR TITLE $webinarTitle AFTER "TITLE:"
TITLE:</strong></p>
<p style="margin: 0;font-size: 12px;line-height: 14px;text-align: left">
//ENTER WEBINAR TIME VARIABLE AFTER "TIME:" $webinarTime
<strong>TIME:</strong>
</p>