【问题标题】:Email subject in Laravel 4Laravel 4 中的电子邮件主题
【发布时间】:2017-10-20 01:56:55
【问题描述】:

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

这是我控制器中的 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>

【问题讨论】:

    标签: html email laravel-4


    【解决方案1】:

    您可以将闭包传递给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));
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2013-07-02
      • 2016-12-07
      • 1970-01-01
      • 2016-08-07
      • 2013-11-30
      • 2013-10-04
      • 2013-12-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多