Re: File array mailing What to do
| From: | WebDev | Date: | Mon, 03 Mar 2003 06:38:56 +0000 |
| Subject: | Re: File array mailing What to do | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-137841@lists.php.net to get a copy of this message | ||
I do not use any loop comand yet
how come I have all email addresses from the data file in the TO: line
but each email is send with unique information to the client,
only TO and From: line is filled with all the values from the data file.
What do I do ?
I hope I explain my self good enough can you help me a bit with the code ?
<?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 = "name text ";
$myemail = "email@server.com;
$myreplyemail = "email@server.com";
$contactname = "$Realf $RealL";
$contactemail = "$Email";
$message = "Dear $Realf $RealL <br> message text here ... use of above
arrays . ";
$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 here";
mail($contactemail, $subject, $message, $headers);
echo "<font face=\"Arial\" size=\"1\" color=\"#000000\">
mail to $Realf
$RealL done ...</font><br> ";
}
fclose ($fp);
?>
----- Original Message -----
From: John W. Holmes <holmes072000@charter.net>
To: 'WebDev' <WebDev@browseabit.com>; <php-general@lists.php.net>
Sent: Sunday, March 02, 2003 7:23 PM
Subject: RE: [PHP] File array mailing Loop problem. Help needed urgently
> [snip]
> > The script is working everything is send the way I wish, the only
> problem
> > is
> > that the 200 user would see all 199 useres email addresses before him
> ..
> > and so on each member Member 800 sees 799 emails in the email as well
> 799
> > times the from address big problem.
> >
> > I want to send each email in single loop ? so that each client gets
> only
> > one email address to see and my whole doing is not a security risk
> [snip]
> > $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 Text here";
> >
> > mail($contactemail, $subject, $message, $headers);
>
> You're constantly building up $headers with each loop. You're first line
> should be
>
> $headers = "MIME-Version: 1.0\r\n";
>
> so that it starts from an empty string and adds the rest. Or, clear
> $headers after you call mail(), so the next loop starts with an empty
> variable.
>
> ---John W. Holmes...
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
>