为了账号安全,请及时绑定邮箱和手机立即绑定

给定 [address] 邮箱中的地址不符合 RFC 2822, 3.6.2

给定 [address] 邮箱中的地址不符合 RFC 2822, 3.6.2

PHP
千万里不及你 2022-12-03 10:56:14
-> 当用户创建帐户时,会向他发送一封验证邮件。这是我的目标。->我正在使用 Laravel,我是新手。->我正确设置了所需的 STMP 详细信息,如密码、用户名、端口、加密->我希望我是清楚的。->在 email.php 中,发件人是:“发件人”=> [“发件人”=> [“地址”=> null,“名称”=> null],所以我的代码是:验证控制器.phpnamespace App\Http\Controllers;use App\User;use Illuminate\Http\Request;class VerifyController extends Controller{    /**     * verify the user with a given token     *      *      */    public function verify($token)        User::where('token', $token)->firstOrFail();            $this->update(['token' => null]); //verify the user            return redirect('/profile');            $this->route('home')            ->with('success', 'Account verifed');    }}用户.php<?phpnamespace App;use App\User;use Illuminate\Contracts\Auth\MustVerifyEmail;use App\Notifications\VerifyEmail;use Illuminate\Notifications\Notifiable;use Illuminate\Foundation\Auth\User as Authenticatable;class User extends Authenticatable implements MustVerifyEmail{    use Notifiable;    /**     * The attributes that are mass assignable.     *     * @var array     */    protected $fillable = [        'email', 'password', 'token'    ];    /**     * The attributes that should be hidden for arrays.     *     * @var array     */    protected $hidden = [        'password', 'remember_token',    ];    /**     * The attributes that should be cast to native types.     *     * @var array     */    protected $casts = [        'email_verified_at' => 'datetime',    ];    public function orders(){        return $this->hasMany('App\Order');    }    /**     * Returns true if user is verified     * @return bool     *      */    public function verified()    {        return $this->token === null;    }    /**     * Send the user a verification user     * @return void     *      *      *      * */    public function sendVerificationEmail()    {        $this->notify(new VerifyEmail($this));    }}
查看完整描述

1 回答

?
波斯汪

TA贡献1811条经验 获得超4个赞

几天几小时后,我意识到 Laravel Frameworks 的版本存在差异。所以问题是我有输入端口:465,主机:smtp.gmail.com,谷歌给你的应用程序的用户名和密码,以及 .env 文件,mail.php,也在config\config.php 中。!我希望对以后有关它的问题有所帮助。



查看完整回答
反对 回复 2022-12-03
  • 1 回答
  • 0 关注
  • 140 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信