Laravel 5,密码重置电子邮件不起作用 [英] Laravel 5, Password reset email not working

查看:92
本文介绍了Laravel 5,密码重置电子邮件不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发laravel 5应用程序.我最近将其托管在共享服务器上,并尝试重置密码.它引发以下异常.

I am working on a laravel 5 application. I recently hosted it on shared server and tried to reset the password. It is throwing the following exception.

Swift_TransportException: 无法与主机mailtrap.io建立连接.[连接超时#110]

Swift_TransportException in StreamBuffer.php line 265: Connection could not be established with host mailtrap.io [Connection timed out #110]

我正在使用默认的身份验证驱动程序.

I am using default authentication driver.

密码控制器中的代码如下:

The code in the Password controller is as follows:

   <?php namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\Auth\PasswordBroker;
use Illuminate\Foundation\Auth\ResetsPasswords;

class PasswordController extends Controller {

    /*
    |--------------------------------------------------------------------------
    | Password Reset Controller
    |--------------------------------------------------------------------------
    |
    | This controller is responsible for handling password reset requests
    | and uses a simple trait to include this behavior. You're free to
    | explore this trait and override any methods you wish to tweak.
    |
    */

    use ResetsPasswords;

    /**
     * Create a new password controller instance.
     *
     * @param  \Illuminate\Contracts\Auth\Guard  $auth
     * @param  \Illuminate\Contracts\Auth\PasswordBroker  $passwords
     * @return void
     */
    public function __construct(Guard $auth, PasswordBroker $passwords)
    {
        $this->auth = $auth;
        $this->passwords = $passwords;

        $this->middleware('guest');
    }

}

我该如何解决这个问题?

How can I solve this problem?

推荐答案

您收到此错误,因为位于项目根目录的.env文件中设置的默认值具有这些值

you are getting this error because the default value set in your .env file located in the root of your project has these values

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null

根据您的要求进行更改,如果这些值设置正确,则更改config/mail.php的值

change them according to your requirement and if these values are set correctly then change the values of config/mail.php

'driver' => env('MAIL_DRIVER', 'smtp'),

通过

'driver' => env('MAIL_DRIVER', 'mail'),

这篇关于Laravel 5,密码重置电子邮件不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆