I'm able to send multiple emails using Mail class in Laravel. However, it is slow. Hence, I would like to create a progress bar using AJAX that shows how many emails have been sent before completion.
How do I find out the number emails that are successfully sent before completion?
Controller
private function sendMail($email){ //get saved email model object
$data = [
"message_body"=>$email->message
];
$recipients = DB::table('newsletter_subscribers')->lists('email'); //list of multiple email addresses
Mail::send('emails.body', $data, function($message)use($recipients,$email)
{
$message->to($recipients)
->subject($email->subject)
->from('admin@mail.prettypal.com','prettypal.com');
});
return 'success';
}