dqspy04266 2018-11-18 21:05
浏览 260

Codeigniter:无法通过SMTP发送电子邮件Google始终拒绝连接

I am struggling in how to send email by using smtp gmail.

This error always happens to me,

[message:protected] => fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Connection refused)
[string:Exception:private] => 
[code:protected] => 2
[file:protected] => /home/u6676613/public_html/testing/system/libraries/Email.php
[line:protected] => 1689
[trace:Exception:private] => Array

Below is my configuration for sending the email

    $config['protocol']='smtp';  

            $config['smtp_host']='ssl://smtp.gmail.com' ;

            $config['smtp_port']='465';  
            //$config['smtp_crypto'] = 'ssl';
            $config['smtp_timeout']='30';    
            $config['smtp_user']=$smtp_username;  
            $config['smtp_pass']=$smtp_password;  
            $config['charset']='utf-8';  
            $config['newline']="
";  
            $config['mailtype'] = 'html'; 

                $config['charset']='utf-8';  
                $config['newline']="
";  
                $config['mailtype'] = 'html';
                $this->load->library('email');
                $this->email->initialize($config);


            $this->email->from('do-not-reply@blabla.com');
            $this->email->to($email);
            $this->email->subject('Testing');
            $this->email->message($msg);
                if($this->email->send())
                {


                    $this->success();
                }
                else
                {
                    show_error($this->email->print_debugger());
                }

If i try to uncomment smtp crypto, i got error " fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known"

FYI ssl extension already enabled. Kindly need your help for this matter

My problem is not ssl extension related so i think its not duplicate with another issue

  • 写回答

2条回答 默认 最新

  • douyan1244 2018-11-19 06:51
    关注

    use sendinblue email provider, it's very easy to implement and it can track emails properly as well as free also.

    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器