Msg#: 11084 posted 1:59 am on Dec 15, 2005 (gmt 0)
I've got an HTML emailer system where the user creates an HTML file with their input from a form. I've had no problem with this part, neither with the email sending and display HTML. However, before the contents of the HTML email (the HTML file the user creates) gets applied as the message body and emailed via PHP, I would like the file to be passed through PHP and any scripts run that happen to be on the template. My actual portion of email code is here (where the file is read into a variable and the mail is sent): $emailHeaders = "From: firstname.lastname@example.org\r\n" . "X-Mailer: PHP/" . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; $emailMessage = file_get_contents(path/filetosend.php); $emailSubject = "Email Subject"; $emailRecipient = email@example.com; mail($emailRecipient, $emailSubject, $emailMessage, $emailHeaders);
How do I make any PHP scripts that are in the "filetosend.php" run before the output is stored into $emailMessage and mailed off?
The email gets sent just as before without any PHP processed, it appears to be choking somewhere around the top graphic and link, and the only thing I can see different is the "//" of the URL, so I removed everything between the table divider tags on that line and still get the same result. Any ideas on that?
Msg#: 11084 posted 5:34 am on Dec 15, 2005 (gmt 0)
I don't know much about eval as I never use it, but from reading the comments at the link I posted, you might have difficulty mixing PHP with HTML as you are doing. You could try replacing the inline HTML with corresponding echos maybe?