简体   繁体   English

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)

Please help me in codeigniter Email, I had many tries but it did not work, Its working On localhost but did not work on server. 请在codeigniter电子邮件中帮助我,我做了很多尝试,但是没有用,它可以在localhost上工作,但是不能在服务器上工作。

ERROR: 错误:

A PHP Error was encountered 遇到PHP错误

Severity: Warning 严重程度:警告

Message: fsockopen(): unable to connect to ssl://smtp.googlemail.com:465 (Connection refused) 讯息:fsockopen():无法连接至ssl://smtp.googlemail.com:465(拒绝连接)

Filename: libraries/Email.php 文件名:libraries / Email.php

Line Number: 2069 行号:2069

Backtrace: 回溯:

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

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

$config = array(
                        'protocol' => 'smtp',
                        'smtp_host' => 'ssl://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
                    );

                    $message =  "
                                <html>
                                <head>
                                    <title>Verification Code</title>
                                </head>
                                <body>
                                    <h2>Thank you for Registering.</h2>
                                    <p>Dear:".$this->input->POST('firstname')."</p>
                                    <p>Email: ".$this->input->POST('user_email')."</p>
                                    <p>Please click the link below to activate your account.</p>
                                    <h4><a href='".base_url()."welcome/activate/".$email=$this->input->POST('user_email')."/'>Activate My Account</a></h4>
                                </body>
                                </html>
                                ";

                    $this->load->library('email', $config);
                    $this->email->set_newline("\r\n");
                    $this->email->from($config['smtp_user']);
                    $this->email->to($this->input->POST('user_email'));
                    $this->email->subject('Signup Verification Email');
                    $this->email->message($message);

                    //sending email
                    if($this->email->send()){
                        $this->session->set_flashdata('Success','Your Account Has Been Created Please Check your email and verify your account..!');
                    }
                    else{
                        $this->session->set_flashdata('message', $this->email->print_debugger());

                    }

You just need to remove the SSL part from your SMTP string in the config array, 您只需要从config数组中的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
                    );

just do 做就是了

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
                    );

to

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
                    );

Now it will surely work for you. 现在肯定会为您工作。 As it worked for me. 因为它对我有用。

暂无
暂无

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

相关问题 出现错误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) 在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) Codeigniter无法连接到ssl://smtp.googlemail.com错误 - Codeigniter unable to connect to ssl://smtp.googlemail.com error 实施电子邮件CodeIgniter库时无法连接到ssl://smtp.googlemail.com:25 - Unable to connect to ssl://smtp.googlemail.com:25 while implementing email CodeIgniter lib 如何解决错误:消息:fsockopen():无法连接到 ssl://smtp.gmail.com:465(连接被拒绝) - How to resolve the error: Message: fsockopen(): unable to connect to ssl://smtp.gmail.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: )]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM