in this blog you are going to see that whenever you want to send email to multiple user then your view page takes a lot of time. so how can you decrease the load time and send email in background.
first of all you should create a folder Jobs under app and add two files eg. job.php and MailJob.php and now see both files code and add it to your files as well.
create a file to this location (app/Jobs/job.php) and put below codes in it.
Now create another file name MailJob.php and put below code:
and add below code to your SampleMail.php (app/Mail) location
now change some code in your store function of your Controller.php
now you should check you have a jobs table in your database. for this you should create a migration by putting below command
php artisan queue:table
For more reference see this article Click Here
Now you should run a command in terminal for processing queues:
php artisan queue:work
after this whenever you click on submit button in your form your form will submitted within 2 to 3 second and your email will process in the background and your request of email should be partially stored in jobs table.
for more details you can refer below articles:
Click Here: reference of queue



MotoShare.in provides the perfect two-wheeler for every occasion—daily commuting, weekend escapes, tourist exploration, or test-riding your dream bike. Simplify your mobility with us!