title: codeigniter - send email
body: <p>I have a CRUD "clientes" and I added a button "email", when I click on it I would like to send an email with a username and a password</p>
  
  <p>here is my button</p>
  
  <pre><code>$crud-&gt;add_action('Email', '', 'pendientes/pendientes_v/enviarmail', 'ui-icon-plus'); 
  </code></pre>
  
  <p>and then the function in my <strong>controller</strong></p>
  
  <pre><code>function copyrows($id)
      {
  
      $this-&gt;load-&gt;model('cliente_model', 'client');
  
      $clientInfo = $this-&gt;client-&gt;getInfo($client_id);    
  
      $this-&gt;email-&gt;from('myemail@gmail.com', 'Demo'); 
      $this-&gt;email-&gt;to($clientInfo['email']);  
  
      $this-&gt;email-&gt;subject('Email Test'); 
      $this-&gt;email-&gt;message('Hola tu usuario es ' . $clientInfo['email'] . ' y tu contraseña es ' . $clientInfo['clave']);     
  
      $this-&gt;email-&gt;send(); 
  
      echo $this-&gt;email-&gt;print_debugger();  
      }
  </code></pre>
  
  <p>my model <strong>cliente_model.php</strong></p>
  
  <pre><code>&lt;?php
  
  
  
      class Cliente_Model extends CI_Model{
  
      public function getInfo($client_id){
          return array('id' =&gt; $cliente_id,'email' =&gt; $email,'clave' =&gt; $clave);
  
      }
      }
  </code></pre>
  
  <p>here the <strong>errors</strong></p>
  
  <p>Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.
  From: "Demo" 
  Return-Path: 
  Reply-To: "myemail@gmail.com" 
  X-Sender: myemail@gmail.com
  X-Mailer: CodeIgniter
  X-Priority: 3 (Normal)
  Message-ID: &lt;51478bcb599c0@gmail.com>
  Mime-Version: 1.0
  Content-Type: text/plain; charset=utf-8
  Content-Transfer-Encoding: 8bit
  =?utf-8?Q?Email_Test?=
  Hola tu usuario es y tu contraseña es@gmail.com>@gmail.com>@gmail.com></p>
  
  <p>A PHP Error was encountered
  Severity: Warning</p>
  
  <p>Message: Cannot modify header information - headers already sent by (output started at /home/oscar/public_html/crud/system/core/Exceptions.php:185)</p>
  
  <p>Filename: core/Common.php</p>
  
  <p>Line Number: 438</p>
  
  <p>I know I am receiving a null value but I can't find the solution, hope someone can help me.
  thanks in advance!</p>