Codeigniter电子邮件 - 浏览器继续加载 [英] Codeigniter email - browser keeps on loading
本文介绍了Codeigniter电子邮件 - 浏览器继续加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用codeigniter发送电子邮件。
I am trying to send email using codeigniter.
<?php
class email_page extends CI_Controller{
function __construct(){
parent::__construct();
}
function index(){
$config = Array(
'protocol'=>'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => '465',
'smtp_user' => 'testmail@gmail.com',
'smtp_pass' => 'password'
);
$this->load->library('email', $config);
$this->email->set_newline('\r\n');
$this->email->from('testmail@gmail.com','Sender name');
$this->email->to('testmail@gmail.com');
$this->email->subject('Test mail');
$this->email->message('This is a test mail from codeigniter');
if($this->email->send()){
echo "Your mail was sent successfully!!!";
}
else{
show_error($this->email->print_debugger());
}
}
}
没有给出任何结果。代码看起来对我很好。有什么错误吗?感谢
The page keeps on loading and does not give any result. The code looks fine to me. Are there any errors? Thanks
推荐答案
我自己找到了答案。
$this->email->set_newline('\r\n');
将以上行更改为
$this->email->set_newline("\r\n");
我不知道这是怎么发生的。
I am not sure how this can happen.
这篇关于Codeigniter电子邮件 - 浏览器继续加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文