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?
From the same doc you linked
This method will automatically take care of pushing a job onto the queue so the message is sent in the background. Of course, you will need to configure your queues before using this feature.
Laravel uses queues to take care of this. You need to enable queuing in the mailable that you're sending. The mail delayed sending also uses the same queues. To make use of this feature you need to have a queue setup and a queue listener or worker running to process the queues. Check the queues doc for more information on this.
https://laravel.com/docs/5.4/queues
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With