PHP not showing in my email
Posted: Wed Mar 25, 2009 3:20 pm
I’m trying to add some htlm and php in a separate file using this for the mail content so that when an email is sent to a customer they get a formatted email:
<snip>
<snip>
In my mail.php file I have:
I receive the email ok with the text details above but the <?PHP echo $Name; ?> is not parsed.
If I was to use instead:
Then this would be parsed okay and $Name would hold the value and come through in the email.
So why when I try to add the external php file is the PHP being ignored. Do I need to add PHP tags to the HTML of my page and echo all of these?
Thanks
<snip>
Code: Select all
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1";
$message = file_get_contents('mail.php');In my mail.php file I have:
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Blah.</title>
</head>
<body>
<table>
<tr>
<td ><p>Thanks <?PHP echo $Name; ?>etc</p>
</td>
</tr>
</table>
</body>
</html>If I was to use instead:
Code: Select all
$message .= 'Thanks'. ' ' ."$Name".' ' ."\r\n";So why when I try to add the external php file is the PHP being ignored. Do I need to add PHP tags to the HTML of my page and echo all of these?
Thanks