我在laravel 5.4.36中发送电子邮件时遇到以下错误,我已经应用了先前由其他用户提出的问题中提到的选项,但是我仍然找不到解决方法
stream_socket_enable_crypto():SSL操作失败,代码为1。OpenSSL错误消息: 错误:1408F10B:SSL例程:SSL3_GET_RECORD:版本号错误
我正在配置中mail.php中使用此设置
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.gmail.com'),
'port' => env('MAIL_PORT', 587),
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@domain.com'),
'name' => env('MAIL_FROM_NAME', 'domain Schools'),
],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => 'hello@domain.com',
'password' => 'mypassword',
'sendmail' => '/usr/sbin/sendmail -bs',
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
'stream' => [
'ssl' => [
'allow_self_signed' => true,
'verify_peer' => false,
'verify_peer_name' => false,
],
],
];
并在环境文件中进行以下设置
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=hello@domain.com
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=tls
答案 0 :(得分:1)
我通过使用MAIL_ENCRYPTION作为ssl和端口465来解决了这个问题