[英]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.