Codeigniter电子邮件无法在服务器fsockopen()中工作:无法连接至ssl://smtp.googlemail.com:465(连接被拒绝)

时间:2019-02-15 06:36:49

标签: php email codeigniter-3

请帮助我使用codeigniter电子邮件, 我尝试了很多,但是没有用, 它可以在localhost上运行,但不能在服务器上运行。

错误:

  

遇到PHP错误

     

严重性:警告

     

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

     

文件名:libraries / Email.php

     

行号:2069

     

回溯:

     

文件:   /home/b4ger7ik8el2/public_html/account/application/controllers/Welcome.php   行:105功能:发送

     

文件:/home/b4ger7ik8el2/public_html/account/index.php行:315   功能:require_once

click() {
  this.doSomething();
}

2 个答案:

答案 0 :(得分:0)

您只需要从配置数组中的SMTP字符串中删除SSL部分,

config = array(
               'protocol' => 'smtp',
                'smtp_host' => 'smtp.googlemail.com',
                'smtp_port' => 465,
                'smtp_user' => 'Email', // change it to yours
                'smtp_pass' => 'Pasword', // change it to yours
                'mailtype' => 'html',
                'charset' => 'iso-8859-1',
                'wordwrap' => TRUE
                    );

答案 1 :(得分:0)

只要

config = array(
               'protocol' => 'smtp',
                'smtp_host' => 'smtp.googlemail.com',
                'smtp_port' => 465,
                'smtp_user' => 'Email', // change it to yours
                'smtp_pass' => 'Pasword', // change it to yours
                'mailtype' => 'html',
                'charset' => 'iso-8859-1',
                'wordwrap' => TRUE
                    );

config = array(
               'protocol' => 'mail',
                'smtp_host' => 'smtp.googlemail.com',
                'smtp_port' => 465,
                'smtp_user' => 'Email', // change it to yours
                'smtp_pass' => 'Pasword', // change it to yours
                'mailtype' => 'html',
                'charset' => 'iso-8859-1',
                'wordwrap' => TRUE
                    );

现在它肯定会为您工作。因为它对我有用。

相关问题