Today I had to fix a script that sends an e-mail using PHPMailer. Here is the intital code:
$mail ->From = "lampdocs@gmail.com" ; |
$mail ->FromName = "Lampdocs.com" ; |
$mail ->AddAddress( "test@lampdocs.com" ); |
$mail ->AddReplyTo( $webmaster_email , "Lampdocs.com" ); |
$mail ->Subject = "Order from New Paypal Address" ; |
I had to send 2 different mails: one to the buyer and another one to administrator. If I tried to send another mail by using the same code, I got 2 recipients for e-mail. I’ve searched for the way in documentation, but the best way was to check the code of the class itself. Here is the string you should add before sending the next e-mail:
$mail ->ClearAllRecipients(); |
This will clear all arrays with recipients. You can now send another e-mail, specifying your next recipient and a copy will not be sent to the first one.