Send email with a template using php

Why not try something as simple as this :

$variables = array();

$variables['name'] = "Robert";
$variables['age'] = "30";

$template = file_get_contents("template.html");

foreach($variables as $key => $value)
{
    $template = str_replace('{{ '.$key.' }}', $value, $template);
}

echo $template;

Your template file being something like :

<html>

<p>My name is {{ name }} and I am {{ age }} !</p>

</html>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)