如何发送laravel重置密码电子邮件排队

时间:2017-08-31 12:41:44

标签: laravel laravel-5 laravel-5.4 laravel-queue laravel-mail

我正在使用laravel 5.4.20,我想让重置密码电子邮件排队。

我自定义了重置密码电子邮件(对于更改主题)。

首先我为它创建了通知:

<?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 [
        //
    ];
}
}

然后我在我的app / user模型中使用了这个功能

use Notifiable;

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

电子邮件是正确的,它将被发送。但是现在该怎么做让这个电子邮件排队?谢谢

0 个答案:

没有答案