9

The Laravel Documentation describes the ability to schedule a mail for later delivery, with the following example:

$when = Carbon::now()->addMinutes(10);

Mail::to($request->user())
    ->cc($moreUsers)
    ->bcc($evenMoreUsers)
    ->later($when, new OrderShipped($order));

No further configuration is mentioned in the documentation (no database tables or whatever seem to be required by that feature). But I'm wondering, how does that work? Where does Laravel stores the information for later retrieval.

Is this feature reliable for longer durations? I want to send a mail to the user 3 days after sign up. May there be the possibility that the mail gets lost? For example when restarting the server?

4

1 回答 1

11

来自您链接的同一个文档

此方法将自动负责将作业推送到队列中,以便在后台发送消息。当然,您需要在使用此功能之前配置您的队列。

Laravel 使用队列来处理这个问题。您需要在您发送的邮件中启用排队。邮件延迟发送也使用相同的队列。要使用此功能,您需要设置队列并运行队列侦听器或工作程序来处理队列。检查队列文档以获取更多信息。

https://laravel.com/docs/5.4/queues

于 2017-05-16T15:41:07.047 回答