LoginSignup
0
0

More than 3 years have passed since last update.

Laravel gmail Connection could not be established with host smtp.gmail.com 原因と対策

Last updated at Posted at 2020-10-16

laravelでメールを送りたい

gmailを使おうとすると

Connection could not be established with host smtp.gmail.com :stream_socket_client(): SSL operation failed with code 1. OpenSSL Error

というエラーが発生するようになった。
ちょっと前までは同じ設定でうまく言っていたのに突然使えなくなった。

設定確認

laravel

\.env
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=xxxx@gmail.com
MAIL_PASSWORD=xxxx
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=xxxx@gmail.com
MAIL_FROM_NAME=xxxx@gmail.com

gmail

安全性の低いアプリは許可
https://myaccount.google.com/lesssecureapps

原因は?

アバスト無料アンチウイルスのスキャンでした。:sweat_smile:
image.png
設定から送信メールのスキャン(smtp)を外せば解決しました。
image.png

フリーソフトに紛れ込むことが多いアバストアンチウイルスですが
こいつがメールをスキャンするから失敗するようになっていたのでした。
不要な人はアンインストールでも解決するでしょうね。
誰かの参考になれば幸いです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0