fsockopen():无法连接到ssl://smtp.gmail.com:465(拒绝连接)

时间:2019-12-30 19:12:40

标签: php

我正在使用gmail smtp代码发送邮件,并且我有一个goDaddy共享服务器,这是我发送邮件的代码:

$this->load->library('email');
        $config = array(
            'protocol'  => 'smtp',
            'smtp_host' => 'ssl://smtp.gmail.com',
            'smtp_port' => 465,
            'smtp_user' => 'xxxxx@gmail.com',
            'smtp_pass' => 'xxxxx',
            'mailtype'  => 'html',
            'charset'   => 'utf-8',
            "wordwrap" => TRUE
        );
        $this->email->initialize($config);
        $this->email->set_mailtype("html");
        $this->email->set_newline("\r\n");
        $this->email->to($mailConfig['to']);
        $this->email->from($mailConfig['from'],'xxxxxxxx');
        $this->email->subject($mailConfig['subject']);
        $this->email->message($message);
        return $this->email->send();

但是我没有成功,这是警告我

<h4>A PHP Error was encountered</h4>
<p>Severity: Warning</p>
<p>Message:  fsockopen(): unable to connect to ssl: //smtp.gmail.com:465 (Connection refused)</p>
<p>Filename: libraries/Email.php</p>
<p>Line Number: 2069</p>

任何人都可以帮助我。

0 个答案:

没有答案