我尝试使用localhost在laravel中发送电子邮件,但收到此错误。我尝试了许多解决方案,还用谷歌搜索,但现在找到了解决方案。请帮我解决这个错误。我在本地主机。 这是错误。
ErrorException
stream_socket_enable_crypto(): SSL operation failed with code 1.
OpenSSL Error messages: error:1416F086:SSL
routines:tls_process_server_certificate:certificate verify failed
这是控制器功能。
$user = $request->all();
Mail::send('emails.email', ['testVar' => $user], function ($m) use ($user) {
$m->from('raja.waleed21@gmail.com', $user['doctor_firstname']);
$m->to('raja.waleed21@gmail.com', $user['doctor_firstname']);
});
这是.env文件设置。
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=raja.email@gmail.com
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=tls
这是我的config/mail.php
文件
<?php
return [
'default' => env('MAIL_MAILER', 'smtp'),
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'ssl'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
],
'ses' => [
'transport' => 'ses',
],
'mailgun' => [
'transport' => 'mailgun',
],
'postmark' => [
'transport' => 'postmark',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => '/usr/sbin/sendmail -bs',
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
],
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];
问题是什么,似乎一切都很好。