Laravel:发送电子邮件:错误(加载cafile流失败)

时间:2019-06-08 14:18:42

标签: laravel

我尝试这样做:link 但这没用:(

错误:

无法加载cafile流:`C:\ xampp \ apache \ bin \ curl-ca-bundle.crt'

// --------------------------------------------- ----------------------------

还有其他解决方法吗?

.env

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=katty17@gmail.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls

Mail.php

'port' => env('MAIL_PORT', 587),



    'from' => [
        'address' => env('MAIL_FROM_ADDRESS', 'kawtarmar17@gmail.com'),
        'name' => env('MAIL_FROM_NAME', 'hotel'),
    ],


    'encryption' => env('MAIL_ENCRYPTION', 'tls'),



    'username' => env('katty17@gmail.com'),

    'password' => env('password'),

    'sendmail' => '/usr/sbin/sendmail -bs',


    'markdown' => [
        'theme' => 'default',

        'paths' => [
            resource_path('views/vendor/mail'),
        ],
    ],



    'log_channel' => env('MAIL_LOG_CHANNEL'),

];

php.ini

...

[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
curl.cainfo ="C:\xampp\apache\bin\curl-ca-bundle.crt"

[openssl]
; The location of a Certificate Authority (CA) file on the local filesystem
; to use when verifying the identity of SSL/TLS peers. Most users should
; not specify a value for this directive as PHP will attempt to use the
; OS-managed cert stores in its absence. If specified, this value may still
; be overridden on a per-stream basis via the "cafile" SSL stream context
; option.
openssl.cafile ="C:\xampp\apache\bin\curl-ca-bundle.crt"
...

2 个答案:

答案 0 :(得分:0)

确保已为电子邮件应用程序启用了两步身份验证,并确保已创建应用程序密码! https://developers.google.com/gmail/imap/imap-smtp

答案 1 :(得分:0)

另外,您可能有两个或多个php.ini文件,请确保指定

的路径
curl-ca-bundle.crt

每个人