4
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'smtp.gmail.com',
'smtp_port' => 465,
'smtp_user' => '[email protected]',
'smtp_pass' => 'XXXX',
'mailtype' => 'html',
'charset' => 'iso-8859-1'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('[email protected]', 'xxxx');
$this->email->to($email);
$this->email->subject('Hi');
$this->email->message('Hi');
if($this->email->send())
{
echo 'Your email was sent.';
}
else
{
show_error($this->email->print_debugger());
}
但它显示错误消息:fsockopen():无法连接到smtp.gmail.com:465(连接被拒绝)。SMTP协议发送邮件不与codeigniter
我在这里看到了解决方案Sending mail with CodeIgniter using SMTP protocol not working但它不工作,我无法找到php.ini。
你在本地尝试吗? –
在你的本地服务器上找到php.in安装的驱动器/ php/php.ini或者你可以找到它进入我的电脑,然后在搜索框中按ctrl + f编写php.ini并查看结果 –
@parvez不,我不是在本地这就是为什么我的电脑无法找到它的主机。 –