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

Kaluna's avatar

Laravel Forge, Queues and mail::later().

Hey everyone.

So I have setup a Queue worker on Laravel Forge.

First problem, is that I have emails that are sending instantly, when I believe I have done enough for them to be "queued".

use Illuminate\Contracts\Queue\ShouldQueue;

class MessageCreated extends Mailable implements ShouldQueue
{
	use Queueable, SerializesModels;
	...
}

And then the function to send the email:

Mail::to( $recipient->email )->later( now()->addMinutes(5), new MessageCreated( $message ) );

QUEUE_CONNECTION is set to Redis, and my Forge worker's connection is redis.

When I click "send now" (which should use the later() method above) just triggers the email instantly.

My second issue, is that it doesn't seem to send my scheduled artisan command:

// App\Console\Kernel.php.

protected function schedule(Schedule $schedule)
{
    $schedule->command(SendEmails::class)->everyThirtyMinutes();
}

I can run it locally and it's absolutely fine.

I've had a response from Laravel Forge, that tell me to read https://laravel.com/docs/10.x/scheduling (which I have). But it seems a bit odd adding $schedule->command(SendEmails::class)->everyThirtyMinutes() to the Kernel file if I have to then go and make a cron job do the exact same?

I'm very confused. Any help hugely appreciated.

Matt

0 likes
1 reply
LaryAI's avatar
Level 58

For the first issue, it seems that the queue worker is not running. Make sure that the queue worker is running by running the following command on the server:

php /path/to/artisan queue:work redis --queue=default

Replace /path/to/artisan with the actual path to the artisan file in your Laravel project.

For the second issue, it is recommended to use a cron job to run the Laravel scheduler. Add the following cron job to your server:

* * * * * cd /path/to/your/project && php artisan schedule:run >> /dev/null 2>&1

Replace /path/to/your/project with the actual path to your Laravel project.

Also, make sure that the APP_ENV variable in your .env file is set to production so that the scheduler runs in production mode.

If you have already set up the cron job and the scheduler is still not running, try running the following command on the server to see if there are any errors:

php /path/to/artisan schedule:run

Replace /path/to/artisan with the actual path to the artisan file in your Laravel project.

Please or to participate in this conversation.