This is something I am working on now.
If you are explaining what I think you are explaining, here is an example php code and variables blended with html that should help. (This was part of a form - obviously)
PHP Code:
<?php
$fromname = stripslashes($_POST['fromname']);
$fromemail = stripslashes($_POST['fromemail']);
$toemail = stripslashes($_POST['toemail']);
$headers = 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";
$headers .= "Content-Transfer-Encoding: 7bit\n";
$headers .= 'From: Sender <'.$fromemail.'>' . "\n";
$headers .= 'Reply-To: '.$fromemail."\n";
$headers .= 'X-Mailers: PHP /'.phpversion() . "\n";
$subject = $_POST['subject'];
$message = $_POST['msg'];
if (@mail($toemail,stripslashes($subject),stripslashes($message),stripslashes($headers)))
{
echo ('<p>Your message has been sent.</p>');
}
else
{
echo ('<p>Your message has failed to send.</p>');
}
As you can see, the whole section is in php so you have to use 's to contain/ break out of the relevant code. The same principal can be used in subject and message.
i.e.
PHP Code:
<?php
$message = 'this is a test page to establish if you can put in a '.$variable.' or not.';