title: How do i send an array in an email message (CodeIgniter)
body: <p>I was wondering how to send an array within an email message. I'm using pre tags to format it in the webpage. But im not able to send any data in the email. Here is the controller that im using:</p>
  
  <pre><code>  &lt;?php 
  
  
      class Notification extends CI_Controller {
  
  
      public function index()
          {
  
  
              $this-&gt;db-&gt;select('product_name,project_code'); 
       $this-&gt;db-&gt;from('user');
       $this-&gt;db-&gt;like('product_name', 'Test');   
  
  
  
       $array = $this-&gt;db-&gt;get()-&gt;result();
       $size = count($array); 
  
       echo 'The number of test are: ';
       echo $size;  
         echo '    ';
      echo "&lt;pre&gt;";
       print_r($array);
       echo "&lt;/pre&gt;";
  
       $config = Array(
                    'protocol' =&gt; 'smtp',
                    'smtp_host' =&gt; 'ssl://smtp.googlemail.com',
                    'smtp_port' =&gt; 465,
                    'smtp_user' =&gt; 'Email',
                    'smtp_pass' =&gt; 'Password',
                    'mailtype'  =&gt; 'text', 
                    'charset'   =&gt; 'iso-8859-1'
                                    );
                      $this-&gt;load-&gt;library('email', $config);
                      $this-&gt;email-&gt;set_newline("\r\n");
  
                      // Set to, from, message, etc.
                       $this-&gt;email-&gt;from('sender', 'Name');
              $this-&gt;email-&gt;to('reciever'); 
  
              $this-&gt;email-&gt;subject(' Test Updates');
  
              $this-&gt;email-&gt;message($array);
  
  
  
                 $result = $this-&gt;email-&gt;send(); 
  
      }
  
  
  
  
  }
  
  ?&gt;
  </code></pre>
  
  <p>I want to send the array $array in the email which is formatted similar to the pre tags. 
  [Note: I've edited out the email details. Other email functions work as expected]</p>