Gaspy
7 months ago

Mail::send works but ::queue doesn't

Posted 7 months ago by Gaspy

I set up Lumen with smtp email. I also installed beanstalkd. My Mailable class looks like this:

namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class AdminNotificationTeam extends Mailable
{
    use Queueable, SerializesModels;
...............
    public function build()
    {
        return $this
            ->to($this->to_address)
            ->subject(...)
            ->view('emails.adminnotificationteam')
            ->with([...])

If I send the email with Mail::send(new AdminNotificationTeam(...) it works. However, if I use Mail::queue(), I get this error:

Argument 1 passed to Illuminate\Mail\Mailable::queue() must be an instance of Illuminate\Contracts\Queue\Factory, null given, called in /var/www/www.sparkchess.com/api/vendor/illuminate/mail/Mailer.php on line 383

in Mailable.php line 169
at Mailable->queue(null)
in Mailer.php line 383
at Mailer->queue(object(AdminNotificationTeam))
in Facade.php line 237
at Facade::__callStatic('queue', array(object(AdminNotificationTeam)))
......

I don't understand what happens. As you can see, Mailer->queue() receives an object, while Mailable->queue() receives null.

Please sign in or create an account to participate in this conversation.