Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter sends three mails instead of one
#1

Hello,


I am using CodeIgniter 3.02 for sending a newsletter. I'm just sending 1 mail to one recipient, but I receive the same mail 3 times.

I don't use a loop. I don't understand why three mails were sent.

My code :

Code:
function sendMailProspects(){
   date_default_timezone_set ("Europe/Berlin");

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

   $config['protocol'] = 'mail';
   $config['charset'] = 'utf-8';
   $config['wordwrap'] = TRUE;
   $config['mailtype'] = 'html';

   $this->email->initialize($config);

   $this->email->to('[email protected]');
   $this->email->from('[email protected]','John DOE');
   $this->email->reply_to('[email protected]', 'John DOE');
   $this->email->subject('Mysubject');
   $this->email->message('<h1>HTML CODE</h1><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Provident.</p>');
   $this->email->set_alt_message('texte');
   $this->email->send();
}

I just execute this method directly in the url, no loop, nothing special.

I've tested this code on localhost and on an shared hosting with the same result: I receive three mails.

What could I be doing wrong?

Thank's

Patrice
Reply
#2

(This post was last modified: 10-28-2015, 01:06 PM by ignitedcms.)

You must be calling it three times. Either in your controller or somewhere else. Check carefully again. Also disable any plugins you might have on your web browser.

http://stackoverflow.com/questions/13971...send-twice
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
Reply
#3

Hello,

I resolved the problem. It was the web browser who are the origin of the problem. I don't know realy why, but with this method, there is't duplicat mail.

function index ()
{
self:ConfusedendMailProspects();
redirect('newsletter');
}
Reply




Theme © iAndrew 2016 - Forum software by © MyBB