【问题标题】:Connection could not be established with host smtp.gmail.com :stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465无法与主机 smtp.gmail.com 建立连接:stream_socket_client():无法连接到 ssl://smtp.gmail.com:465
【发布时间】:2020-11-03 18:24:43
【问题描述】:

当我尝试使用 Gmail SMTP 通过 Laravel 发送电子邮件时,遇到以下错误:

无法与主机 smtp.gmail.com 建立连接:stream_socket_client():无法连接到 ssl://smtp.gmail.com:465(连接超时)

这是错误的痕迹

set_error_handler(function ($type, $msg) {
    throw new Swift_TransportException('Connection could not be established with host '.$this->params['host'].' :'.$msg);
});

【问题讨论】:

  • 您是否启用了openssl 扩展?
  • 这有时可能是因为某些东西阻止了目标站点!您的防火墙会不会妨碍您?
  • 是的 OpenSSL 已启用
  • OpenSSL 1.1.1 2018 年 9 月 11 日

标签: php laravel smtp


【解决方案1】:

您需要设置电子邮件配置。将此命令输入您的终端

php artisan view:clear
php artisan route:clear
php artisan cache:clear
php artisan config:clear

php artisan config:cache

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-11-21
    • 2016-11-07
    • 1970-01-01
    • 1970-01-01
    • 2019-03-01
    • 2012-12-20
    • 2018-07-03
    • 2016-02-07
    相关资源
    最近更新 更多