codeigniter email-> send正在发送两次 [英] codeigniter email->send being send twice
问题描述
我使用codeigniter 2与tank_auth库。
在名为user_model的模型中,它有一个函数(_send_email())来发送电子邮件:
i am using codeigniter 2 with the tank_auth library. in the model named user_model it has an function (_send_email()) to send an email:
function _send_email($type, $email, &$data)
{
$this->load->library('email');
$this->config->set_item('language', 'dutch');
$this->email->set_newline("\r\n");
$this->email->from($this->config->item('webmaster_email', 'tank_auth'), $this->config->item('website_name', 'tank_auth'));
//$this->email->reply_to($this->config->item('webmaster_email', 'tank_auth'), $this->config->item('website_name', 'tank_auth'));
$this->email->to($email);
$this->email->subject(sprintf($this->lang->line('auth_subject_'.$type), $this->config->item('website_name', 'tank_auth')));
$this->email->message($this->load->view('email/'.$type.'-html', $data, TRUE));
$this->email->set_alt_message($this->load->view('email/'.$type.'-txt', $data, TRUE));
if($this->email->send()){
echo "sendit";
}
}
我尝试从这样的控制器调用此函数:
i try to call this function from a controller like this:
public function email($value='')
{
$this->lang->load('tank_auth', 'dutch');
$this->load->model('user_model');
$data = array("site_name" => "site name");
$this->user_model->_send_email('bestelling_geplaatst', "my_email@hotmail.com",$data); // send
}
问题是电子邮件被发送两次到电子邮件地址
遇到此问题的任何人都知道在哪里寻找解决方案(或问题)
anyone who run across this problem an know's where to look for an solution ( or the problem)
更多信息:
我想在我的控制器中创建一个方法,像这里: http://ellislab.com/codeigniter/user-guide/libraries/ email.html
i am trying to make a method in my controller just like the example in the use guide like here: http://ellislab.com/codeigniter/user-guide/libraries/email.html
$this->load->library('email');
$this->email->from('your@example.com', 'Your Name');
$this->email->to('someone@example.com');
$this->email->cc('another@another-example.com');
$this->email->bcc('them@their-example.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
此方法也会发送电子邮件两次!
推荐答案
原因是我的插件Firebug Lite谷歌浏览器。后我禁用此页面只请求一次!
在这里找到了awnser:
http://stackoverflow.com/a/10580841/1108772
The reason is i have the plugin Firebug Lite for Google Chrome. after i deactivated this the page only requested once! found awnser right here: http://stackoverflow.com/a/10580841/1108772
感谢大家的回复和您的帮助
Thanks everyone for replying and all you help
这篇关于codeigniter email-> send正在发送两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!