About phpmailer, and $mail->AddAddress
im looping through something that generates an email and I want it to send each unique item to a unique person.
I found, that when I use $mail->AddAddress, the next time it loops, It just adds the address, including all the recipients from the previous loops, and sends them all out.
How can I reset the address variable?
      loop(xtimes){
      [generate customer $message]
      $mail->Host       = "smut.blabla.co开发者_JS百科m"; 
      $mail->port = 25;
      $mail->AddReplyTo('test@test.com', 'test name');
      $mail->AddAddress($currentEmployeeEmail);
      $mail->SetFrom('test@test.com', 'test name');
      $mail->Subject = "Your Daily Report, for $currentEmployee - $reportDate";
      $mail->MsgHTML($message);
      $mail->AddAttachment('logo_white.png'); 
      $mail->Send();
      }
Is there something equal to SetAddress?
What if you create a new mailer at the beginning of the loop, like:
$mail = new PHPMailer();
If I remember, there's also a ClearAddresses method, like:
$mail->ClearAddresses();
You can use:
$mail->ClearAllRecipients( ) 
 加载中,请稍侯......
      
精彩评论