Note that there are some explanatory texts on larger screens.

plurals
  1. POcodeigniter email->send being send twice
    text
    copied!<p>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:</p> <pre><code>function _send_email($type, $email, &amp;$data) { $this-&gt;load-&gt;library('email'); $this-&gt;config-&gt;set_item('language', 'dutch'); $this-&gt;email-&gt;set_newline("\r\n"); $this-&gt;email-&gt;from($this-&gt;config-&gt;item('webmaster_email', 'tank_auth'), $this-&gt;config-&gt;item('website_name', 'tank_auth')); //$this-&gt;email-&gt;reply_to($this-&gt;config-&gt;item('webmaster_email', 'tank_auth'), $this-&gt;config-&gt;item('website_name', 'tank_auth')); $this-&gt;email-&gt;to($email); $this-&gt;email-&gt;subject(sprintf($this-&gt;lang-&gt;line('auth_subject_'.$type), $this-&gt;config-&gt;item('website_name', 'tank_auth'))); $this-&gt;email-&gt;message($this-&gt;load-&gt;view('email/'.$type.'-html', $data, TRUE)); $this-&gt;email-&gt;set_alt_message($this-&gt;load-&gt;view('email/'.$type.'-txt', $data, TRUE)); if($this-&gt;email-&gt;send()){ echo "sendit"; } } </code></pre> <p>i try to call this function from a controller like this:</p> <pre><code>public function email($value='') { $this-&gt;lang-&gt;load('tank_auth', 'dutch'); $this-&gt;load-&gt;model('user_model'); $data = array("site_name" =&gt; "site name"); $this-&gt;user_model-&gt;_send_email('bestelling_geplaatst', "my_email@hotmail.com",$data); // send } </code></pre> <p><strong>the problem is that the email is being sent twice to the email adres</strong></p> <p>anyone who run across this problem an know's where to look for an solution ( or the problem)</p> <p><strong>More info:</strong> </p> <p>i am trying to make a method in my controller just like the example in the use guide like here: <a href="http://ellislab.com/codeigniter/user-guide/libraries/email.html" rel="nofollow">http://ellislab.com/codeigniter/user-guide/libraries/email.html</a></p> <pre><code> $this-&gt;load-&gt;library('email'); $this-&gt;email-&gt;from('your@example.com', 'Your Name'); $this-&gt;email-&gt;to('someone@example.com'); $this-&gt;email-&gt;cc('another@another-example.com'); $this-&gt;email-&gt;bcc('them@their-example.com'); $this-&gt;email-&gt;subject('Email Test'); $this-&gt;email-&gt;message('Testing the email class.'); $this-&gt;email-&gt;send(); </code></pre> <p><strong>This method also sends the email twice!</strong></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload