CodeIgniter Forums
Email class problem: Multiple recipients - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Email class problem: Multiple recipients (/showthread.php?tid=32445)



Email class problem: Multiple recipients - El Forum - 07-23-2010

[eluser]vaxis[/eluser]
Hi guys, I'm doing a newsletter system for my company and i have a problem with sending emails.
I send emails trough a foreach loop:

Code:
foreach($temp as $email) {
    $this->email->clear();
    $this->email->to($email);
    $this->email->from('[email protected]');
    $this->email->subject('Here is your info ');
    $this->email->message('Hi Here is the info you requested.');
    if( ! $this->email->send() ) {
        echo $this->email->print_debugger();
        exit();
    }
}
It send only first email in my array.

Someone had this problem? Thanks guys.


Email class problem: Multiple recipients - El Forum - 07-23-2010

[eluser]xzela[/eluser]
what is the structure of the $email var? It should be an array.

Also, make sure the email is being sent, else, based on this line: exit(); the foreach loop will stop if the email is not sent, which may be causing the issue.


Hope that helps.


Email class problem: Multiple recipients - El Forum - 07-26-2010

[eluser]vaxis[/eluser]
I solved the problem... I was working on my machine and email to my company was sent, but i forget that i were working in local and the problem was that... Now all working fine.
Thanks for help.