Sending html template as email message with submited data from contact form

Viewed 14

There's a contact form, that sends data as email message:

//mail function for sending mail
$to=$email.",".$adminemail; 
$headers .= "MIME-Version: 1.0"."\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1'."\r\n";
$headers .= 'From:PHPGurukul Contact Form Demo<info@phpgurukul.com>'."\r\n";
$ms.="<html></body><div>
<div><b>Name:</b> $name,</div>
<div><b>Phone Number:</b> $phoneno,</div>
<div><b>Email Id:</b> $email,</div>";
$ms.="<div style='padding-top:8px;'><b>Message : </b>$message</div><div></div></body></html>";
mail($to,$subject,$ms,$headers);

I've made a html email template just like this:

https://pastebin.com/CghcTk1L

How could I send that template as email message with submited data from contact form? I tried to change $ms. block into template code with same variables but it didn't worked.

0 Answers
Related