【发布时间】:2017-07-11 08:53:56
【问题描述】:
目前网站已经托管在 wordpress PHP 中。在 Codeigniter PHP 中实现以扩展现有网站中的不同模块有一个测验模型部分。实施该测验模型,在您继续玩之前,您应该登录或注册 - 当用户注册并单击注册时遇到错误..它将向您的电子邮件 ID 发送一个电子邮件验证链接。但它显示错误
Message: fsockopen(): unable to connect to ssl://smtp.gmail.com:465
(Connection refused)
代码在本地主机上运行并正常工作,但在我实时托管时却没有
你可以去查看link live
模型文件
public function sendEmail($receiver){
$from = ""; //senders email address
$subject = 'Verify email address'; //email subject
//sending confirmEmail($receiver) function calling link to the user,
inside message body
$message = 'Dear User,<br><br> Please click on the below activation link
to verify your email address<br><br>
<ahref=\'http://www.localhost/codeigniter/index.php/
Signup_Controller/confirmEail/'
.md5($receiver).'\'>http://www.localhost/codeigniter/index.php/
Signup_Controller/confirmEmail/'. md5($receiver) .'</a><br><br>Thanks';
//config email settings
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.gmail.com';
$config['smtp_port'] = '465';
$config['smtp_user'] = $from;
$config['smtp_pass'] = ''; //sender's password
$config['mailtype'] = 'html';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = 'TRUE';
$config['newline'] = "\r\n";
$this->load->library('email', $config);
$this->email->initialize($config);
//send email
$this->email->from($from);
$this->email->to($receiver);
$this->email->subject($subject);
$this->email->message($message);
if($this->email->send()){
//for testing
echo "Check your email";
return true;
}else{
echo "email send failed";
return false;
}
}
【问题讨论】:
-
显示您发送电子邮件的代码
-
@YadhuBabu 请检查
标签: php codeigniter live email-verification