Parsing a variable with variables in it

Oleg Butuzov

New member
mail with headers...


Code:
$mymail="uadude@hotmail.com";
$subj="Hello, dude!";
$usermessage="Best regards. chao.";

$headers .= "MIME-Version: 1.0\r\n";
 $headers .= "Content-type: text/html; charset=windows-1251\r\n";
 $headers .= "From: Pejone <pejone@ukr.net>\r\n";
 $headers .= "X-Priority: 1\r\n";
 $headers .= "X-MSMail-Priority: High\r\n";
 $headers .= "X-Mailer: Pejone Feedback Form Mailer aka PFFM v1.0.2 special for alesh.ru\r\n";
 
mail($mymail, $subj, $usermessage, $headers);
 
I don like Fasttempelates, so i use functions

for exemple

Code:
fucntion message_to_sent($Name, $Password, $email, $mymail)
{
$content="Hello $Name
Your login : $Name
Your pass: $Password

Bla-bla-bla...
Bye.
";

mail("$Name <$email>", "Subject", $content ,"From:  $mymail");
}
 
I've never looked at fast templates befor but here is what I would do.
Code:
<?php
$content = "From: address@domain.com 
Subject: Subject 
Content: Hi [fname], 
Your account is as follows: 
Username: [username] 
Password: [password]";

$content = str_replace('[fname]',$fname,$content); 
$content = str_replace('[username]',$username,$content); 
$content = str_replace('[password]',$password,$content); 
?>
 
Back
Top