$mail='
<style>
.msgBody{width: 60%;margin-left: 20%;border-radius: 10px;background: #fff;color: #222;font-family: Tahoma;border: 1px solid #ebebeb;overflow: hidden;}
.msgBody .header{width: 100%;padding-top: 20px;padding-bottom: 20px;background: #2a394f;} .msgBody .content{width: 100%;padding-top: 80px;padding-bottom: 80px;text-align: center;}
.msgBody .content .btn{width: 40%;margin-left: 30%;height: 30px;line-height: 30px;font-size: 18px;color: #fff;background: #0fa8f4;border-radius: 7px;cursor: pointer;padding-top: 20px;padding-bottom: 20px;text-align: center;margin-top: 40px;}
.msgBody .content a{text-decoration: none;}
</style>
<div class="msgBody">
<div class="header">
<img src="http://scs39.ru/img/logo.png" style="width: 30%; height: auto; margin-left: 35%;">
</div>
<div class="content">
'.$name.', здравствуйте!<br>
Для активации нажмите на кнопку ниже:<br>
<a href="http://domain.ru/activate.php?key='.$key.'&l='.$phone'"><div class="btn">Активировать аккаунт</div></a>
</div>
</div>';
$mail=convert_cyr_string($mail,"w","k");
$hed="Content-Type: text/html; charset=koi8-r
From:Автописьмо<info@domain.ru>
To: Клиент
Subject: Активация аккаунта
Content-Type: text/html; charset=koi8-r";
$hed=convert_cyr_string($hed,"w","k");
mail($email,"",$mail,$hed);
$mail = file_get_contents('mail.tpl');
$mail = str_replace('{name}', 'value', $mail);
$mail = str_replace('{key}', 'value', $mail);
$mail = str_replace('{phone}', 'value', $mail);