电子邮件主题在Laravel 4中

时间:2017-05-19 20:24:30

标签: html email laravel-4

我有一个简单的问题,直到现在我都无法解决,问题是当用户要求提供休息密码时,电子邮件发送正确,除了电子邮件的一件事,不包含主题。我想添加主题,但我无法做到。

这是我的控制器中的postRemind函数:

 public function postRemind()
    {
        $this->reminderForm->validate(Input::only('email'));
        switch ($response = Password::remind(Input::only('email'))) {
            case Password::INVALID_USER:
                return Redirect::back()->with('error', Lang::get($response));
            case Password::REMINDER_SENT:
                return Redirect::back()->with('status', Lang::get($response));
        }
    }

这是我的刀片:

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
</head>
<body>
    <h3>Password Reset</h3>
    <div>
        You have requested password reset. Complete this form: {{ URL::to('password/reset', array($token)) }}
    </div>
</body>
</html>

1 个答案:

答案 0 :(得分:3)

您可以将关闭传递给Password::remind,您可以在其中设置主题。

https://laravel.com/docs/4.2/security#password-reminders-and-reset

public function postRemind()
{
    $this->reminderForm->validate(Input::only('email'));

    $response = Password::remind(Input::only('email'), function($message)
    {
        $message->subject('Password Reminder');
    });

    switch ($response) {
        case Password::INVALID_USER:
            return Redirect::back()->with('error', Lang::get($response));
        case Password::REMINDER_SENT:
            return Redirect::back()->with('status', Lang::get($response));
    }
}