1 year ago

Queue sending all mails to last recipient

Posted 1 year ago by Kaustubh

Hi There, I am currently facing an issue in queue mails. I made a queue table and it works perfectly when i send email to one person, but the issue comes when i fetch all records from table and foreach each of them and send mail to each recipient, It sends all the emails to the last recipient of the record. When i send email without queue it works perfectly.

for eg. i have two records in table 1st has [email protected] and another one has [email protected], when i use queue it send both emails to [email protected] and not to [email protected]

            // Daily Reports to BUSINESS HEAD
            $business = Business::where('b_daily',1)->select('business_name','b_email_id')->get();
            foreach ($business as $bus){
                dispatch(new SendEmailReports($bus->b_email_id));

Please let me know if i am missing something.

Please sign in or create an account to participate in this conversation.