如何解决电子邮件验证Laravel 8
我正在使用 laravel 8,并试图在注册时验证我的电子邮件 并出现错误
没有发件人地址就无法发送消息
为 this is error i'm getting 这是我的.env文件中的 SMTP设置
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=abc@gmail.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=admin@gmail.com
MAIL_FROM_NAME="${APP_NAME}"
这是我的用户模型代码
<?php
namespace App\Models;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable implements MustVerifyEmail
{
use HasFactory,Notifiable,HasRoles;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name','email','password',];
/**
* 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',];
}
这是我来自web.php的路线
Auth::routes(['verify' => true]);
解决方法
改变你的端口或者你可以做php artisan config:cache
转到文件夹 vendor\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.php 然后更改 $options = []; to $options['ssl'] = array('verify_peer' => false,'verify_peer_name' => false,'allow_self_signed' => true);
我在这里找到了解决方案 https://laracasts.com/discuss/channels/laravel/stream-socket-enable-crypto-ssl-operation-failed-with-code-laravel-7。它对我有用。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。