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

时间:2019-01-30 05:29:11

标签: email codeigniter-3

我遇到此错误

'

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

'

文件名:libraries / Email.php

行号:2069

请帮助我解决此问题。 这是我的代码

$conf                   =   array(
    'protocol'          =>  'smtp',
            'smtp_host'         =>  'smtp.googlemail.com',
            'smtp_crypto'       =>  'ssl',
            'smtp_port'         =>  '465',
            'smtp_timeout'      =>  '7',
            'smtp_user'         =>  'mygmail@gmail.com',
            'smtp_pass'         =>  'mypassword',
            'charset'           =>  'iso-8859-1',
            'mailtype'          =>  'html',
            'validation'        =>  TRUE,
            'wordwrap'          =>  TRUE
        );
        $this->load->library('email',$conf);
        $this->email->set_newline("\r\n");
       $this->email->from('fromsample@gmail.com', 'sample name');

        $this->email->to('fromsample@gmail.com'); 
        $this->email->subject('sample subject');
        $this->email->message('sample message ');  


if($this->email->send()){
          echo 'Successfully sent';
        }
        else{
            echo $this->email->print_debugger();
        } 

0 个答案:

没有答案