【发布时间】:2019-02-15 06:36:49
【问题描述】:
请在 codeigniter 电子邮件中帮助我, 我尝试了很多次,但没有成功, 它在本地主机上工作,但在服务器上没有工作。
错误:
遇到了 PHP 错误
严重性:警告
消息:fsockopen():无法连接到 ssl://smtp.googlemail.com:465(连接被拒绝)
文件名:libraries/Email.php
行号:2069
回溯:
文件: /home/b4ger7ik8el2/public_html/account/application/controllers/Welcome.php 行:105 功能:发送
文件:/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());
}
【问题讨论】:
标签: php email codeigniter-3