今天测试自己的QQ企业邮箱配置为Laravel的发送邮箱,故而去配置 .env 和 config/mail.php 文件,但发现官方提供的出现错误。下文主要是测试用,所以代码参考官方教程比较简陋。
Laravel已经提供了密码重置的接口,首先在路由中(app/Http/routes.php)增加:
Route::get('password/email', 'Auth\PasswordController@getEmail');//密码重置链接请求路由
Route::post('password/email', 'Auth\PasswordController@postEmail');
Route::get('password/reset/{token}', 'Auth\PasswordController@getReset');// 密码重置路由
Route::post('password/reset', 'Auth\PasswordController@postReset');
详细代码在Illuminate\Foundation\Auth\ResetsPasswords.php
当然得在resources/views下新建
auth/password.blade.php:

auth/reset.blade.php:

emails/password.blade.php:
您正在请求重置密码: {{ url('password/reset/'.$token) }}
这样,密码重置的展示页面已经完成,下面来配置QQ企业邮箱。
Step1

Step2,虽然官网显示发送服务器端口是465,但是在实际测试中发现465无效,25成功!!用户名密码填写你自己的邮箱和密码。

Step3,这里的address和.env的MAIL_USERNAME一致,注意加密方式为ssl,name为发件人昵称

Step4,访问localhost/password/mail

Step5,输入邮箱,点击按钮,对应的邮箱就会收到带有token的重置链接,点击链接就会跳转到reset界面重置密码。当你收到这份邮件时说明你已经设置成功了!

参考文档
http://laravelacademy.org/post/1290.html
网友评论