1

我在 localhost 上发送电子邮件,但在服务器(digitalocean+serverpilot)上没有相同的设置。启用了 php 的开放 ssl 支持。

php get "消息:fsockopen():无法连接到 ssl://smtp.yandex.com.tr:465(连接超时)

codeigniter 框架得到:

遇到以下 SMTP 错误: 110 连接超时 无法使用 PHP SMTP 发送电子邮件。您的服务器可能未配置为使用此方法发送邮件。

我的代码是:

 $config = Array('protocol' => 'smtp','smtp_host' => 'ssl://smtp.yandex.com.tr','smtp_port' => 465, 'smtp_user' => 'info@mydomain.com','smtp_pass' => 'mypass','mailtype'  => 'html', 'charset'   => 'utf-8');

$this->load->library('email');
$this->email->initialize($config);
$this->email->set_newline("\r\n");

$this->email->from('info@mydomain.com', 'test.com');
$this->email->to('testing@yandex.com');
$this->email->subject('test');


$this->email->message('test body');
$this->email->send();
 echo $this->email->print_debugger();

nslookup smtp.yandex.com:

服务器:2001:4860:4860::8844 地址:2001:4860:4860::8844#53

非权威答案:smtp.yandex.com 规范名称 = smtp.yandex.ru。名称:smtp.yandex.ru 地址:93.158.134.38 名称:smtp.yandex.ru 地址:87.250.250.38 名称:smtp.yandex.ru 地址:213.180.204.38 名称:smtp.yandex.ru 地址:213.180.193.38 名称: smtp.yandex.ru 地址:77.88.21.38

并且 telnet 请求有效。

4

1 回答 1

0

您的传出连接可能被防火墙阻止。

使用类似tcptraceroute的工具来定位问题。

于 2016-07-24T20:59:29.987 回答