Reputation: 638
In one of our project, we are sending mails to users using Zend SMTP. The Zend version is 1.12.
We use the addCC function for sending copy of mails to a set of users. Two of the users are having same name but different email address. When we pass the recipient array to addCC function, the mail is going to only one of the user.
zend excepts the cc user list in the form of
$ccListArray = array('name1'=>'email1','name2'=>'email2','name3'=>'email3')
$mail->addCc($ccListArray);
When we have 2 users with same name, the first entry gets overwritten.
I can add each users individually, but we are sending hundreds of mails every day and looping the CC list is always not feasible.
Is there any other way i can add all mails to CC list at a time?
Upvotes: 1
Views: 258
Reputation: 5772
The keys of an array must be unique.
May be you can try something like this:
$ccListArray = array(['name' => 'name1', 'email' => 'email1'],
['name' => 'name2', 'email' => 'email2'],
['name' => 'name3', 'email' => 'email3']);
foreach($ccListArray as $cc){
$mail->addCc($cc['email'], $cc['name']);
}
Upvotes: 2