Laravel won't send anymore mails after testing my job class on prouction using "QUEUE_DRIVER=sync"

119 Views Asked by At

At first, it sends some emails then stopped without giving any errors, I tested tinker and it gives "null" without receiving anything!!

this is my config

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=haith*****@gmail.com
MAIL_PASSWORD=******
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=haith*****@gmail.com
MAIL_FROM_NAME=Mar****
2

There are 2 best solutions below

0
On BEST ANSWER

Finallllyy, i find out that when i open a ssh session at the same time of executing the job , ovh block the connection of email host , so when i test my code instead of opening ssh session to run the comman "php artisan queue:work" , i run it in my controller after the dispatch like that "Artisan::call('queue:work');"

I hope that this help someone!!

1
On

with sync driver, you effectively have no queue as the queued job runs immediately. This is useful for local or testing purposes, but clearly not recommended for production as it removes the performance benefit from setting up your queue. try to swap to database driver

QUEUE_DRIVER=database

php artisan queue:table
php artisan migrate