Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

AshAsley's avatar

How to use cron jobs Queue email in laravel 5.2 through mail::later for online server (bluehost cloud hosting )

How to queue email in Laravel 5.2 in online server.

For local development it's working absolutely perfect, but when I upload to cpanel its not working at all.

I have done the following things on my local server that work absolutely fine :

Queuing file configuration: +go to env file and set the queue driver to database

+goto composer and create database tables as "" php artisan queue:table "" also run "" php artisan queue failed-table "" and finally run "" php artisan migrate ""

+the database tables will be created and migrated

+Now in order to queue jobs or send email after a few seconds I have entered this syntax : Mail::later(5,'frontend.general.checkout.email.orderby',array('maildata' => $maildata),function($message) use($maildata) { $message->to($maildata["email"],'Ali')->subject($maildata["subjectorderby"]); });

+In order to listen for the queue jobs run the composer command "" php artisan queue:listen ""

---------------------------This all works fine in my local server------------------------

Now for cpanel I have written same thing but it did'nt worked.Also I set up the cron jobs time and command same as php artisan queue:listen. No email is recieved after 5 seconds so far.

Any technical Laravel developer can help in this matter.Any person's right suggestion would be greatly appreciated and I hope that answer to this question would also help someone else in performing this task

0 likes
3 replies
AshAsley's avatar

anyone please answer this question as it is very critical for me

AshAsley's avatar

I hate to see that no one has yet answered this question. Is laravel community so short of answers or rather people dont tend to bother to help others in tasks

d3xt3r's avatar

Also I set up the cron jobs time and command same as php artisan queue:listen.

What do you mean? What is cron frequency and how have to set it ?

Please or to participate in this conversation.