0
votes

From Laravel documentation:

Queueing By Default

If you have mailable classes that you want to always be queued, you may implement the ShouldQueue contract on the class. Now, even if you call the send method when mailing, the mailable will still be queued since it implements the contract

Is there a way to default queue emails even when calling Mail:send as in Laravel but in Lumen?

I've tried implementing the ShouldQueue contract on my Mailables but they still get sent right away, my queues are working as I use them explictly in other cases.

1

1 Answers

0
votes

First, make sure you have QUEUE_DRIVER other than sync in .env file. Use database, beanstalkd, or redis driver.

Second, if you get queue is null error, you must bind the queue first.

app('queue');
Mail::to($email)->send($mailable);

or if your mailable doesn't implement ShouldQueue

app('queue');
Mail::to($email)->queue($mailable);

Source