Process File to file values, then mail file as HTML EMail

From: Date: Mon, 07 Apr 2003 11:53:57 +0000
Subject: Process File to file values, then mail file as HTML EMail
Groups: php.general 
Request: Send a blank email to php-general+get-142683@lists.php.net to get a copy of this message
Hi Everyone, I have managed to create a little script that sends out HTML Mail getting the body content from a file I can easily edit as needed (see below). Everything works well so long as there is no customisation of the mail body content. What I need to do is find a way of setting a value such as "$_GET['ToName']" as part of the content. What I have tried is to simply put variable name in the text, such as "Dear $_GET['ToName']," but all I get is the code and no value. <?php // Get message body from file (HTML) content. $filename = "htmlpage.html"; $handle = fopen ($filename, "rb"); $contents = fread ($handle, filesize ($filename)); fclose ($handle); // Formatting of SMTP Mail Headers, $mailheaders = "MIME-Version: 1.0"; $mailheaders .= "\r\n"; $mailheaders .= "Content-type: text/html; charset=iso-8859-1"; $mailheaders .= "\r\n"; $mailheaders .= "From: "; $mailheaders .= $_POST['FromName']; $mailheaders .= " <"; $mailheaders .= $_POST['FromEMail']; $mailheaders .= ">"; $mailheaders .= "\r\n"; $mailheaders .= "Reply-To: "; $mailheaders .= $_POST['FromEMail']; $mailheaders .= "\r\n"; $mailheaders .= "X-Mailer: PHP/" . phpversion(); $mailheaders .= "\r\n"; $mailheaders .= "X-Priority: 3"; $mailheaders .= "\r\n"; $mailheaders .= "X-MSMail-Priority: Normal"; $mailheaders .= "\r\n"; $mailheaders = str_replace("\r", "\n", $mailheaders); $mailheaders = str_replace("\n\n", "\n", $mailheaders); $mailheaders = str_replace("\n", "\r\n", $mailheaders); $MessageSubject .= $_POST['FromName']; $MessageSubject = " would like to recommend us."; $SendEMail = $_POST['SendEMail']; mail($SendEMail, $MessageSubject, $contents, $mailheaders); ?> Hoping someone can help me out as after 2 days I still can't solve it. Thanks Stephen

« previous php.general (#142683) next »