All Queues & Jobs lessons

Queueing emails & notifications

4 min read

Any mailable can be queued by chaining ->queue() instead of ->send():

Mail::to($user)->queue(new WelcomeMail($user));

Or make the mailable always queue itself:

class WelcomeMail extends Mailable implements ShouldQueue
{
    use Queueable;
    // …
}

Notifications

For multi-channel delivery (mail, database, slack, broadcast), use a Notification:

php artisan make:notification DuelInvited
public function via(object $notifiable): array
{
    return ['database', 'mail'];
}

Sending: $user->notify(new DuelInvited($duel));

If the notification class implements ShouldQueue, every channel runs on the queue automatically — including the database write.