codeigniter email->发送两次 [英] codeigniter email->send being send twice

查看:176
本文介绍了codeigniter email->发送两次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用codeigniter 2与tank_auth库。
在名为user_model的模型中,它有一个函数(_send_email())发送电子邮件:

  function _send_email $ type,$ email,&$ $ data)
{
$ this-> load-> library('email');
$ this-> config-> set_item('language','dutch');

$ this-> email-> set_newline(\r\\\
); $($ this-> config-> item('webmaster_email','tank_auth'),$ this-> config-> item('website_name')中的
$ this-> 'tank_auth'));
// $ this-> email-> reply_to($ this-> config-> item('webmaster_email','tank_auth'),$ this-> config-> item('website_name ','tank_auth'));
$ this-> email->至($ email); $($ a- ,'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()){
echosendit;
}
}

我尝试从这样的控制器调用此函数:

  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); //发送
}

问题是电子邮件正在两次发送遇到这个问题的任何人都知道在哪里寻找解决方案(或问题)


的电子邮件地址



更多信息:



我正在使用控制器中的一个方法,就像使用指南中的示例一样如下所示: http://ellislab.com/codeigniter/user-guide/libraries/ email.html

  $ this-> load-> library('email'); 

$ this-> email-> from('your@example.com','您的姓名');
$ 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('测试电子邮件类');

$ this-> email-> send();

此方法还会发送电子邮件两次!

解决方案

原因是我的插件Firebug Lite for Google Chrome。之后我停用了这个页面只要求一次!
在这里找到awnser:
https://stackoverflow.com/a/10580841/1108772



感谢大家的回复和所有帮助


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 
}

the problem is that the email is being sent twice to the email adres

anyone who run across this problem an know's where to look for an solution ( or the problem)

More info:

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();

This method also sends the email twice!

解决方案

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: https://stackoverflow.com/a/10580841/1108772

Thanks everyone for replying and all you help

这篇关于codeigniter email->发送两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆