title: sending email to all newsletter members with codeigniter
body: <p>I want to send an email using <code>codeigniter</code> library to my newsletter members and I want to mention each members' Email address in email's content. For doing that, I used <code>foreach loop</code> to send the email one by one. <strong>The problem is that the code sends email to just one member ( the first member ) of my newsletter.</strong> I've checked my code which gets members from the database and it printed out all the members. </p>
  
  <p>This is my model:</p>
  
  <pre><code>function send_news()
  {
      $subscribers = $this-&gt;get_subscriber_data();
      foreach($subscribers as $subscriber)
      {
          $this-&gt;load-&gt;helper('typography');
  
          //Format email content using an HTML file
          $data['news_Title'] = $this-&gt;input-&gt;post('news_Title');
          $HTML_Message = $this-&gt;load-&gt;view('admin/includes/newsletter_html_format', $data, true);
  
          $config['mailtype'] = 'html';
          $this-&gt;email-&gt;initialize($config);
  
          $this-&gt;email-&gt;from('newsletter@site.com', 'newsletter of site.com');
          $this-&gt;email-&gt;to($subscriber-&gt;subscriber_Email);
          $this-&gt;email-&gt;subject('newsletter of site.com');
          $this-&gt;email-&gt;message($HTML_Message);
  
          return $this-&gt;email-&gt;send();
      }
  
  }
  </code></pre>
  
  <p>and this is how I'm getting subscribers list:</p>
  
  <pre><code>function get_subscriber_data($options = array())
  {
      $query = $this-&gt;db-&gt;get('mg_newsletter');
  
      if(isset($options['subscriber_Id']))
          return $query-&gt;row(0);
  
      return $query-&gt;result();
  }
  </code></pre>
  
  <p>when I try to echo <code>$subscriber-&gt;subscriber_Email</code> it prints all the emails in the database one after another. but it does not send email to all of them. What am I doing wrong?!</p>