lundi 11 février 2019

Laravel queue throws FatalThrowableError when trying to send mails

i am trying to send a mail on a named queue (registration.user) as soon as a new user registers.

i have created a mailable and a job, the job is dispatched and is working fine util the queue starts running. the job is throwinf an error and the stacktrace is pushed in the failed jobs table.

the job is as following:

<?php

namespace App\Jobs;

use App\Mail\testMail;
use App\User;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Support\Facades\Mail;

class SendRegistrationMailJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    /**
     * @var User
     */
    private $user;

    /**
     * Create a new job instance.
     *
     * @param User $user
     */
    public function __construct(User $user)
    {
        $this->user = $user;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        Mail::to($this->user->getAttribute('email'))->send(new testMail());
    }
}

stacktrace (pastebin) (~ verwijst naar de map waar het project staat)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire