首页 > 解决方案 > 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****

标签: phplaravellaravel-jobs

解决方案


使用同步驱动程序,您实际上没有队列,因为排队的作业会立即运行。这对于本地或测试目的很有用,但显然不推荐用于生产,因为它消除了设置队列带来的性能优势。尝试交换到数据库驱动程序

QUEUE_DRIVER=database

php artisan queue:table
php artisan migrate

推荐阅读