mercredi 27 février 2019

Mail not being queued

Within Laravel 5.7, I have run this using database queue and everything worked fine. When using Redis, on the other hand, I am having an issue with public $queue. For some odd reason:

  1. If I set public $queue the email is sent straight away.
  2. If I remove public $queue mail is added to the default queue.

I have a file similar to below:

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;

class TestEmail extends Mailable implements ShouldQueue
{
    use Queueable, SerializesModels;

    public $queue = 'mail';
}

The mail class is called using send() similar to: Mail::to($request->user())->send(new OrderShipped($order));

When I switch to defining queue then everything works as should:

Mail::to($request->user())
    ->queue(new OrderShipped($order));



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire