Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Including variables in a mail template

Status
Not open for further replies.

gcrighton

Technical User
Feb 23, 2002
9
ES
Hi,

My formprocessor script uses the file() function to read the text for an autoresponder email. It reads the text no problem but is not parsing the PHP variables contained in the file. How can I do this if I want to include the user name in the external template?

$mailtext2 = file("mailtext2.php");
$mailtext2 = join("", $mailtext2);
$content_mail2 = $mailtext2;

Thanks in advance,

Gary
 
you have to use the eval function like this:

$mailtext2 = file("mailtext2.php");
$mailtext2 = join("", $mailtext2);
eval("\$content_mail2 =\"$mailtext2\";");

Note: do not forget the backslashes or the double quotes. Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
Hey Anikin,

$mail_en = file("mail_en.php");
$mail_en = join("", $mail_en);
eval("\$content_en =\"$mail_en\";");

Is the bees knees - thanks for your help!

Gary
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top