Laravel won’t send anymore mails after testing my job class on prouction using “QUEUE_DRIVER=sync”

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****

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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

Method 2

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!!


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x