Re: Assigning the contents of a file to a variable

From: Date: Thu, 11 Apr 2002 16:22:40 +0000
Subject: Re: Assigning the contents of a file to a variable
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-92607@lists.php.net to get a copy of this message
Edward R. Bailey wrote:
Hi, I am trying to create an html automatic response email to users that fill out a form. Workflow - 1. User fills out form and selects submit 2. The contents of the form are then mailed to a secretary for record keeping 3. (Where the problem is) An html based email is sent to the email address that the user entered into the form. 4. The user is redirected to a confirmation page Ok - steps one and two work fine so on to step three. After the code that mails the form then my code -- if ("PHP_MAIL_FORM=true") { $to = "$address_email"; $subject = "Uncharted Outposts Newsletter";
$message = <html><p>Test Email</p></html>;        $headers = "To: $name_first <$address_email>\nFrom: <My
Company>\nReply-To: <My Company>\nMIME-Version: 1.0\nContent-type: text/html; charset=iso-8859-1\n";
mail($to, $subject, $message, $headers);      }
Where $address_email and $name_first are variables from the form The script as is works fine, but I want to assign the contents of a separate file (a web page) to $message instead of inserting the contents of the file as a string in the actual script. I want the body of the email to come from a separate file to help make changing the body of the email easier too. I tried using - readfile("includes/news.html") $message = file("includes/news.html");
will do what you need.
But that did not work and instead inserted file into the actual webpage instead of the email. Does anyone have an idea or suggestion? Thanks for your help, Ed Mike...


« previous php.general (#92607) next »