Forum Moderators: coopster

Message Too Old, No Replies

using the mail() function with a large message

         

Sarah Atkinson

2:11 pm on Aug 1, 2007 (gmt 0)

10+ Year Member



I have a large message that I want to mail with the php mail() function the message is written in html with some php code added in it. (basically <?php echo $widget;?>)

The entire message is a separate php file however it requires variables from the the main possessing file that contains the mail() function.

How do I use this file in the message? I though maybe uses output buffering but I can't get it to work.

Sarah

eelixduppy

2:26 pm on Aug 1, 2007 (gmt 0)



Try something like this:

$message = addslashes(file_get_contents('message.php'));
eval("\$msg = \"$message\";");
mail('to@example.com','subject',$msg);

Just a note. The message file should contain the text with the variable names right in it instead of the php echo code. For example, it might contain this:


Hello $name, welcome to our website! It appears you have been inactive since $date, but that is ok....blah blah blah

Should work fine after those changes