简体   繁体   English

在Codeigniter中无法发送电子邮件-fsockopen():无法连接到ssl://smtp.gmail.com:465(连接被拒绝)

[英]in Codeigniter Unable to send email - fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Connection refused)

etting fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Connection refused) while sending email. etting fsockopen():发送电子邮件时无法连接到ssl://smtp.gmail.com:465(连接被拒绝)。

My email Controller is : 我的电子邮件控制器是:

public function send() { 
     $from = "abc@gmail.com"; 
     $to = $this->input->post('email'); 
     date_default_timezone_set("Asia/Kolkata");

     $ci = get_instance();
        $ci->load->library('email');
        $config['protocol'] = "smtp";
        $config['smtp_host'] = "ssl://smtp.gmail.com";
        $config['smtp_port'] = "465";
        $config['smtp_user'] = "abc@gmail.com"; 
        $config['smtp_pass'] = "Mypwd";
        $config['mailpath'] = "/usr/sbin/sendmail";
        $config['mailtype'] = "text";
        $config['newline'] = "\r\n";

        $ci->email->initialize($config);

     $this->email->from($from, 'Your Name'); 
     $this->email->to($to);
     $this->email->subject('Email Test'); 
     $this->email->message('Testing the email class.'); 

     //Send mail 
     if($this->email->send()) {

     $this->load->view('pages/successfully'); }
     else {

    echo "Error in sending Email.";
      show_error($this->email->print_debugger());
     }
  } 

A PHP Error was encountered 遇到PHP错误

Severity: Warning 严重程度:警告

Message: Cannot modify header information - headers already sent by (output started at /home/simt/public_html/system/core/Exceptions.php:272) 消息:无法修改标题信息-已发送的标题(输出从/home/simt/public_html/system/core/Exceptions.php:272开始)

Filename: core/Common.php 文件名:core / Common.php

Line Number: 568 行号:568

Backtrace: 回溯:

File: /home/simt/public_html/application/controllers/Email.php Line: 46 Function: show_error 文件:/home/simt/public_html/application/controllers/Email.php行:46功能:show_error

File: /home/simt/public_html/index.php Line: 315 Function: require_once 文件:/home/simt/public_html/index.php行:315功能:require_once

Connection refused means exactly that the connection to the peer was refused. 拒绝连接意味着完全拒绝与对等方的连接。 This is because the server either does not expect connections at the port or because a firewall is blocking the connection. 这是因为服务器不希望在该端口上建立连接,或者是由于防火墙阻止了该连接。 It is probably the last one in your case so check for firewalls which might block the access on the local machine but also in the network. 它可能是您的情况中的最后一个,因此请检查防火墙是否可能阻止本地计算机以及网络上的访问。 It might also that a firewall in front of the server or the server itself is blocking access for example if your system is on some blacklist known for sending spam. 例如,如果您的系统位于已知的发送垃圾邮件的黑名单中,则服务器前面的防火墙或服务器本身也可能阻止访问。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何解决错误:消息:fsockopen():无法连接到 ssl://smtp.gmail.com:465(连接被拒绝) - How to resolve the error: Message: fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Connection refused) Codeigniter电子邮件无法在服务器fsockopen()中工作:无法连接至ssl://smtp.googlemail.com:465(连接被拒绝) - Codeigniter Email did not Working in Server fsockopen(): unable to connect to ssl://smtp.googlemail.com:465 (Connection refused) 消息:fsockopen():无法连接到ssl://smtp.gmail.com:465(连接超时) - Message: fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Connection timed out) CodeIgniter电子邮件:fsockopen():无法连接到ssl://smtp.gmail.com托管中 - CodeIgniter email: fsockopen(): Unable to connect to ssl: //smtp.gmail.com in hosting 连接失败。 错误 #2:stream_socket_client():无法连接到 ssl://smtp.gmail.com:465(连接被拒绝) - Connection failed. Error #2: stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465 (Connection refused) [SMTP:无法连接套接字:fsockopen():无法连接至ssl://smtp.gmail.com:465(未知错误)(代码:-1,响应:)] - [SMTP: Failed to connect socket: fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Unknown error) (code: -1, response: )] Connection could not be established with host smtp.gmail.com:stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465 - Connection could not be established with host smtp.gmail.com :stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465 出现错误fsockopen():使用codeigniter电子邮件类发送电子邮件时,无法连接到smtp.googlemail.com:465(连接超时) - getting error fsockopen(): unable to connect to smtp.googlemail.com:465 (Connection timed out) while sending email using codeigniter email class 讯息:fsockopen():无法连接至ssl://smtp.googlemail.com:465(权限被拒绝) - Message: fsockopen(): unable to connect to ssl://smtp.googlemail.com:465 (Permission denied) 无法在 laravel 5.6 电子邮件发送中与主机 smtp.gmail.com [连接被拒绝 #111] 建立连接 - Connection could not be established with host smtp.gmail.com [Connection refused #111] in laravel 5.6 email send
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM