Welcome Guest, Not a member yet? Register   Sign In
Multiple Email Not Sending Correct
#3

(07-24-2015, 07:06 AM)mwhitney Wrote: After you send the first email, you're either going to show_error() or redirect(), so the loop breaks. Instead, you should just track the results and store the debug messages for any failures, then show the errors or success message after the loop. For example:

PHP Code:
public function sendmail() {

    $config = array( 
        'protocol'  => 'smtp'
        'smtp_host' => 'ssl://squid.arvixe.com'
        'smtp_port' => 465
        'smtp_user' => '******'
        'smtp_pass' => '******'
    ); 
    $this->load->library('email'$config);

    $mailResults = array();        
    $results 
$this->get_emails();
    foreach ($results as $result) {
        $this->email->from(config_item('email'), config_item('website_name'));
        $this->email->to($result['email']);
        $this->email->subject('My mail through codeigniter from localhost'); 
        $this->email->message('Hello World…');
        if (! $this->email->send()) {
            $mailResults[] = $this->email->print_debugger();
        }
    }

    if (! empty($mailResults)) {
        show_error(implode('<br />'$mailResults));
    }

    $this->session->set_flashdata('success''Your e-mail has been sent!' $result['email']);
    redirect('admin/mail');


Thank you now under understand
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply


Messages In This Thread
RE: Multiple Email Not Sending Correct - by wolfgang1983 - 07-24-2015, 07:15 AM



Theme © iAndrew 2016 - Forum software by © MyBB