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

(This post was last modified: 07-24-2015, 06:48 AM by wolfgang1983.)

I am trying to send multiple email but having small issue. I can get my news letter emails from the database but I can not get the email to send correct. For some reason it only sends the message to the first email in the list and not the others.

How can I make sure it sends to all emails in list.

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);
        
    
$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()) {
             
            
show_error($this->email->print_debugger()); 
            
        } else {

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


Email Model


PHP Code:
public function get_emails() {
$this->db->select('email');
$this->db->from($this->db->dbprefix 'news_letter');
$query $this->db->get();

return 
$query->result_array();

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
Multiple Email Not Sending Correct - by wolfgang1983 - 07-24-2015, 06:47 AM



Theme © iAndrew 2016 - Forum software by © MyBB