Hi Guys,
Need some help. I'm using phpmailer (for php4) i'm reading a textfile with about 200 email addresses and i'm sending 20 emails every 5 seconds. Works perfectly. But got a major problem, a lot of clients have comeback to me and said that they've received the same copy multiple times.
I can't figure out why its doing this can someone please help me resolve this ??
Many thanks.
<?php
error_reporting(0);
set_time_limit(0);
include_once('phpmailer/class.phpmailer.php');
$body = 'This is a test';
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "";
$mail->From = "Me";
$mail->FromName = "FromName";
$mail->Subject = "Subject";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
$mail->MsgHTML($body);
$myFile = "listmanagement/uploads/34_250210_1267104673.txt";
$data = file("$myFile");
foreach($data as $value) {
$v = trim($value);
$emails .= "$v,";
}
$email_addrs = explode(",", $emails);
$throttle = 20;
$i = 0;
// Now, run a loop through all the email addresses in the mailing list.
foreach($email_addrs as $email_addr)
{
if ($i % $throttle == 0)
{
sleep(5);
}
$mail->AddBCC($email_addr);
$mail->Send();
$mail->ClearBCCs();
$i++;
}
$mail->AddAddress("me@me.com", "Company");
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message sent!";
}
?>