php - How to pass a 2 dimensional array value in a swift mailer setTo function -
i getting 2 dimensional array value result after loop.the value $chunk[$i][$j]
.and when passed value setto function, error showing as
warning: preg_match() expects parameter 2 string, array given in h:\xampp \htdocs\sngmarket\vendor\swiftmailer\swiftmailer\lib\classes\swift\mime\headers \mailboxheader.php line 350
.
how solve this?.here code
$query = $em->createquery("select distinct u.emailaddress acmeregistrationbundle:userlist u"); $grp_emails[] = $query->getresult(); $chunk = array_chunk($grp_emails, 10); $get_chunk_count = count($chunk); for($i=0;$i<$get_chunk_count;$i++) { $count_inside_count = count($chunk[$i]); for($j=0;$j<=$count_inside_count;$j++) { $mails=$chunk[$i][$j]; $message = \swift_message::newinstance() ->setsubject('hello email') ->setfrom('marketplace@socialnetgate.com') ->setto($mails) ->setreturnpath('gowtham@ephronsystems.com') ->setbody('hello world'); $this->get('mailer')->send($message); return array(); } }
i think overthinking this.
have looked @ documentation on how send batch emails without recipients being aware of each other? in snippet each email contains 10 recipients, may better sending recipients, still pretty bad.
have @ sending emails in batch , @ plugins make sure don't reach limit of emails allowed send in time frame.
Comments
Post a Comment