[英]Laravel 5.4 - Can't queue a mail
For some reason whenever I run 由于某种原因,我每次跑步
Mail::to($user)->queue(new WelcomeEmail($user))
it sends immediately instead of queuing it. 它立即发送而不是排队。 I've already followed the Driver Prerequsites .
我已经遵循了Driver Prerequsites的要求 。
I tried to run it on artisan tinker
and it still doesn't add to the queue. 我试图在
artisan tinker
上运行它,但它仍然没有添加到队列中。
This is my WelcomeEmail
class: 这是我的
WelcomeEmail
类:
<?php
namespace App\Mail\User;
use Illuminate\Bus\Queueable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use App\Modules\User\User;
class WelcomeEmail extends Mailable
{
use Queueable, SerializesModels;
/**
* @var Model
*/
public $user;
/**
* Create a new message instance.
* @param User $user
*/
public function __construct(User $user)
{
$this->user = $user;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->markdown('emails.user.registered');
}
}
Is it because I'm running on a Windows machine? 是因为我在Windows计算机上运行吗?
Based on your comment in the question, the trouble is that you have your queue_driver
set to SYNC
in your .env
file. 根据您对问题的评论,麻烦在于您已将
.env
文件中的queue_driver
设置为SYNC
。 This "driver" will process everything immediately, this is useful when developping. 该“驱动程序”将立即处理所有内容,这在开发时很有用。
You need to set it to "database" if you want to use the database driver, or "redis" for the redis driver. 如果要使用数据库驱动程序,则需要将其设置为“数据库”,对于redis驱动程序,则需要将其设置为“ redis”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.