Laravel mailable subject not working if I queue the mailable

Viewed 628

I'm working with laravel 7.0 and for some reason when I write subject in my build method of a mailable and queue it by calling the queue method of the Mail facade the subject isn't changing, it is taking the mailable classname and setting it as the subject. If I hard code the $subject variable in the mailable class it works and if I don't queue it then the subject gets set. Anybody knows how to solve this? I'm using database driver to handle the queue.

Mailable build method

public function build()
{
    return $this->subject(config('app.name') . ' OTP')
         ->markdown('emails.otp');
}

How I'm queuing up the mail to send

\Illuminate\Support\Facades\Mail::to($this->user->email)
            ->queue(new \App\Mail\Otp($generatedOtp));
0 Answers
Related