Php Yii2 Swiftmailer SMTP有时发送,有时失败
我正在从一台服务器向另一台服务器发送一个API请求,它应该会通过电子邮件进行响应。问题是,有时它成功,有时它无法发送消息 日志上写着:Php Yii2 Swiftmailer SMTP有时发送,有时失败,php,yii2,smtp,swiftmailer,Php,Yii2,Smtp,Swiftmailer,我正在从一台服务器向另一台服务器发送一个API请求,它应该会通过电子邮件进行响应。问题是,有时它成功,有时它无法发送消息 日志上写着: [Swift_TransportException] exception 'Swift_TransportException' with message 'Connection could not be established with host smtp.office365.com [php_network_getaddresses: getaddrinfo
[Swift_TransportException] exception 'Swift_TransportException' with message 'Connection could not be established with host smtp.office365.com [php_network_getaddresses: getaddrinfo failed: Name or service not known #0]' in /var/www/html/yii2/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:269
我的配置是:
'mail' => [
'smtp' => 'smtp.office365.com',
'user' => 'sample@mail.com',
'password' => 'sample',
'port' => 587,
'encryption' => 'tls',
],
我试图重做我的后端,但似乎问题是SMTP。这里是这样吗?还是我的后台?无论何时失败,它都会以“InternalServerErrorAcceler500”作为响应,但不会在httpd中记录任何错误
我正在使用CentOS
getaddrinfo失败
主要是因为缺少internet连接,所以是服务器吗?我认为它总是连接到互联网,而且网站总是打开的。你认为iptables(防火墙)可能是罪魁祸首吗?嗯,有时候ping smtp.office365.com会导致“ping:smtp.office365.com:名称或服务未知”getaddrinfo失败
主要是因为缺少internet连接,所以是服务器吗?我认为它总是连接到互联网,而且网站总是打开的。你认为iptables(防火墙)可能是罪魁祸首吗?嗯,有时候ping smtp.office365.com会导致“ping:smtp.office365.com:名称或服务未知”