how to send laravel reset password email queued

1k views Asked by At

im using laravel 5.4.20 and i want to make reset password emails queued.

i customized reset password email a little (for change subject).

first i created the notification for it :

<?php

namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;

class ResetPassword extends Notification implements ShouldQueue
{
use Queueable;
public $token;

public function __construct($token)
{
    $this->token = $token;
}


public function via($notifiable)
{
    return ['mail'];
}



public function toMail($notifiable)
{
    return (new MailMessage)
        ->subject('its sub')
        ->line('You are receiving this email because we received a password reset request for your account.')
        ->action('Reset Password', url('password/reset', $this->token))
        ->line('If you did not request a password reset, no further action is required.');
}



public function toArray($notifiable)
{
    return [
        //
    ];
}
}

and then i used this fucntion in my app/user model

use Notifiable;

public function sendPasswordResetNotification($token)
{
    // Your your own implementation.
    $this->notify(new ResetPasswordNotification($token));
}

the email is correct and it will sent. but now what should i do for make this email queued? thank you

0

There are 0 answers