【问题标题】:Email Verification Laravel 8电子邮件验证 Laravel 8
【发布时间】:2021-02-15 09:41:20
【问题描述】:

我正在使用 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]);

【问题讨论】:

    标签: email smtp verification email-verification laravel-8


    【解决方案1】:

    改变你的端口或者你可以做php artisan config:cache

    【讨论】:

      【解决方案2】:

      转到文件夹 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。它对我有用。

      【讨论】:

        猜你喜欢
        • 2021-03-24
        • 2020-03-18
        • 2019-02-12
        • 2017-06-23
        • 1970-01-01
        • 2021-06-22
        • 1970-01-01
        • 2017-08-21
        • 2021-04-28
        相关资源
        最近更新 更多