Stephen Sunderlin wrote:
It seems to be ccing each email to everyone and I'd like it to only include
one email address with each email.  I've tested in on three of my personal
emails and I see to get six messages in my inbox.

I'm also sending about 4000 emails and would like some pointers to avoid
time out errors.

Finally for the life of me can't figure out how to execute an insert
statement to record a history of each email sent.  When I include the insert
statement, no emails are send.

Following is the code.

Any help or direction would be greatly appreciated.




$mail = new PHPMailer();

include ("cxnfile"); $cxn = mysqli_connect($host,$user,$password,$database)
         or die ("Couldn't connect to server");

$query =      "select *
                From db
                where groupid = groupid";

$result = mysqli_query($cxn,$query)
        or die("Couldn't execute select query.");
        while($row = mysqli_fetch_assoc($result))
$mail->Host = ""; $mail->From = "[EMAIL PROTECTED]";

$mail->From = "[EMAIL PROTECTED]";
$mail->FromName = "Company";
$mail->AddAddress("$email", "$Contact");

$mail->IsHTML(True); $mail->Subject = "$Subject";
$mail->Body = "$PR";
$mail->WordWrap = 50;

   echo 'Message was not sent.';
   echo 'Mailer error: ' . $mail->ErrorInfo;
   echo 'Message has been sent.';


You're re-using the same message each time around the loop. Each time you call AddAddress you're, erm, adding another address. You either need to reset the recipients or reset the message each time round the loop (I'm not familiar with Phpmailer so I have no idea how to do this).



PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to