Reputation:
i am trying to send a mail on a named queue (registration.user) as soon as a new user registers in my laravel (5.7) application.
i have created a mailable and a job, the job is dispatched and is working fine util the queue starts running. the job is throwing 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) (~ is where the project is)
Upvotes: 0
Views: 58
Reputation:
it turned out to be a mistake I made while defining the queues, I just used the wrong syntax
Upvotes: 1