Re: executeing another files code
| From: | M. Sokolewicz | Date: | Sat, 04 Dec 2004 22:42:52 +0000 |
| Subject: | Re: executeing another files code | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-203498@lists.php.net to get a copy of this message | ||
Ryan A wrote:
Hey all, Heres my problem, I have this written in "email.fff" ############# Start file ########## Hi $firstname $lastname, We have recieved your request for support. We will get back to you shortly. Regards, $sitename P.S below is the message you submitted: $message ############# End file ########## Question is: How can I get the file in my php script and fill in those variables then send the above email message. I know how to open a file via fread/file I now how to do the mail() etc... Just a little confused.... Thanks, Ryanwell, seen as you've put it in a separate file, we'll need to eval it. So, let's go. I'm assuming $sitename and $message are already set with the correct values before the script I'm going to show you starts: <?php // assume PHP 4.3.0+, otherwise use eg. $c = implode("\n", file('email.fff')); $c = file_get_contents('email.fff'); eval('$emailMsg = "'.$c.'";'); // user@example.com can be replaced with eg $emailAddress if you've defined it earlier on. mail('user@example.com', 'Re: support request', $emailMsg); ?> hope that helps :) - Tul