How can I send an email using php then add a template design in the email? I\'m using this:
$to = \"someone@example.com\";
$subject = \"Test mail\";
$mes
First, you have to make a HTML template:
Below code is the mailing code that uses the template.
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$to=$email; //change to ur mail address
$subject="UandBlog - Send Email Template Demo";
$message = file_get_contents('Your template path'); // Your Template
$headers = 'MIME-Version: 1.0'."\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1'."\r\n";
$headers .= "From: noreply@uandblog.com";
mail($to, $subject, $message, $headers);
}
You can also download the full code with the template from UandAblog.