phpMailer - How do you Remove Recipients phpMailer - How do you Remove Recipients php php

phpMailer - How do you Remove Recipients


You can use clearAllRecipients( )

$mailer->clearAllRecipients( ); // clear all


im using this always before sending email to recipients:

// clear addresses of all types$mail->ClearAddresses();  // each AddAddress add to list$mail->ClearCCs();$mail->ClearBCCs();

then im doing just this: (not using CC or BCC, $toaddress is just an array of recipients)

foreach($toaddress as $key=>$val) { $mail->AddAddress( $val ); }

im using PHPMailer 5.2