【问题标题】:Laravel 5.8 stopped sending emailLaravel 5.8 停止发送电子邮件
【发布时间】:2022-01-06 07:19:01
【问题描述】:

从我的系统发送电子邮件完全停止工作。 .env 设置没问题。我试图运行这段代码来测试:

php artisan tinker

Mail::getSwiftMailer()->registerPlugin (
    new Swift_Plugins_LoggerPlugin(new Swift_Plugins_Loggers_EchoLogger(false))
);
$to = 'youraddress@example.com';
Mail::raw('Testmail', function ($message) use($to) {  
    $message->to($to)->subject('Testmail'); 
});

我收到了这个错误:

PHP Warning:  stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/usuario/dev/dev-contaja/vendor/predis/predis/src/Connection/StreamConnection.php on line 127
PHP Warning:  stream_socket_client(): unable to connect to tcp://redis:6379 (php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution) in /home/usuario/dev/dev-contaja/vendor/predis/predis/src/Connection/StreamConnection.php on line 127
Predis/Connection/ConnectionException with message 'php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution [tcp://redis:6379]'

我正在使用 docker。

【问题讨论】:

  • 无法访问邮件主机。
  • 我使用命令nc -v 'smtp.myhost' port_number 连接成功。
  • 错误信息很清楚,和邮件无关。 “无法连接到 tcp://redis:6379 ...名称解析暂时失败”

标签: php laravel laravel-5


【解决方案1】:

在以下httpd.conf文件中,正确配置ServerName

/etc/httpd/conf/httpd.conf

如下:

ServerName 127.0.0.1:80

ServerName sitename

这解决了我面临的类似问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-09-12
    • 2019-10-21
    • 2020-07-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多