I have function in my php code:
foreach ($myarray as $customer) {
//doing some code
$this->sendMail($this->attachedfiles,$customer);
}
$this->response($this->success);
This code loop over array and the send email to each one with attachedfiles and response to the client in the end.
the problem with this is that it take a lot of time. so i tried some thing like this:
$customer_email = array();
$customer_attachedfiles = array();
foreach ($myarray as $customer) {
array_push($customer_email, $customer);
array_push($customer_attachedfiles, $this->attachedfiles);
}
$this->response($this->success);
$indextmp = 0;
foreach ($customer_email as $customer2) {
$attachedfiles_tmp = $customer_attachedfiles($indextmp);
$this->sendMail($attachedfiles_tmp,$customer2);
$indextmp++;
}
And in this format the mail are not sent, Any idea what can be the problem?