working with file and mail
| From: | WebDev | Date: | Tue, 04 Mar 2003 00:29:57 +0000 |
| Subject: | working with file and mail | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-137966@lists.php.net to get a copy of this message | ||
Hello all
I hat some help last night from John Holmes but I am still stuck with even more option in the code
My Problem:
I have a text data file of users I wish to email all with custom information from the file, each
line represents a user with 21 seperated datafields ( serperator "|" )
...
User|UserN|UserL|Pass|Email|Country|etc..|etrc..|| etc.||
...
The following code makes the loop a security risk well User 100 sees 99 email address ....
<?php
$fp = fopen ("data/default2.users", "r");
while (!feof ($fp)) {
$buffer = fgets($fp, 4096);
list ($User, $UserN, $Pass, $Date, $Realf, $RealL, $Email, $Street, $City, $State, $Postal,
$Country, $Phone, $Webaddress, $ex1, $ex2, $ex3, $ex4, $ex53, $ex7 ) = split ("\|",
$buffer);
$myname = "browseabit";
$myemail = "Email@domain.com";
$contactname = "$Realf $RealL";
$contactemail = "$Email";
$message = "Dear $Realf $RealL message ....";
$subject = "Subject text here";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$myname." <".$myemail.">\r\n";
$headers .= "To: ".$contactname." <".$contactemail.">\r\n";
$headers .= "Reply-To: ".$myname." <$myreplyemail>\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-MSMail-Priority: High\r\n";
$headers .= "X-Mailer: Server
mail($contactemail, $subject, $message, $headers);
echo "<font face=\"Arial\" size=\"1\" color=\"#000000\">
mail to $Realf $RealL done ...</font><br> ";
}
fclose ($fp);
?>
Can somebody please help me with the script ?