title: sending mails with codeigniter
body: <p>i have a form where the users will be able to send their messages to different mail ids. The form has fields like from, to, subject etc. the users will give their mail id in the 'from' filed and the receiver's mail id in the 'to' fields. the problem is i'm not being able to send mail though i think my code is ok. Does CodeIgniter allow to send emails in this way?? </p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>class Email_send extends CI_Controller {   
  
      function Email_send()
      {
          parent::__construct();
          $this-&gt;load-&gt;library('email');
          $this-&gt;load-&gt;helper('url');
          $this-&gt;load-&gt;helper('form');
      }
  
      function index()
      { 
          $config = Array(
              'protocol' =&gt; 'smtp',
              'smtp_host' =&gt; 'ssl://smtp.googlemail.com',
              'smtp_port' =&gt; 465,
              'subject'  =&gt; $this-&gt;input-&gt;post('subject'),
              'message'  =&gt; $this-&gt;input-&gt;post('message'),
              'from'    =&gt; $this-&gt;input-&gt;post('from'),
              'to'  =&gt; $this-&gt;input-&gt;post('to'),
          );
  
          $this-&gt;load-&gt;library('email', $config);
          $this-&gt;email-&gt;set_newline("\r\n");
  
          $this-&gt;email-&gt;initialize($config);
  
          $this-&gt;email-&gt;from($config['subject']);
          $this-&gt;email-&gt;to($config['to']); 
  
          $this-&gt;email-&gt;subject($config['from']);
          $this-&gt;email-&gt;message($config['message']);  
  
          if($this-&gt;email-&gt;send())
          {
              $this-&gt;load-&gt;view('success_em');
          }
  
          else
          {
              show_error($this-&gt;email-&gt;print_debugger());
          }
      }
  }
  </code></pre>
  
  <p><strong>View</strong></p>
  
  <pre><code>        echo form_open('Email_send', $attributes); ?&gt;
  
  &lt;p&gt;
          &lt;label for="from"&gt;Your mail ID &lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;
          &lt;?php echo form_error('from'); ?&gt;
          &lt;br /&gt;&lt;input id="name" type="text" name="from"value="&lt;?php echo set_value('from'); ?&gt;"  /&gt;
  &lt;/p&gt;
  
  &lt;p&gt;
          &lt;label for="to"&gt;To &lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;
          &lt;?php echo form_error('to'); ?&gt;
          &lt;br /&gt;&lt;input id="to" type="text" name="to" value="&lt;?php echo set_value('to'); ?&gt;"  /&gt;
  &lt;/p&gt;
  
  &lt;p&gt;
          &lt;label for="subject"&gt;Subject of the mail&lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;
          &lt;?php echo form_error('subject'); ?&gt;
          &lt;br /&gt;&lt;input id="subject" type="text" name="subject"  value="&lt;?php echo set_value('subject'); ?&gt;"  /&gt;
  &lt;/p&gt;
  
  
  &lt;p&gt;
          &lt;label for="message"&gt;Your Message&lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;
          &lt;?php echo form_error('message'); ?&gt;
          &lt;br /&gt;&lt;textarea id="message" style="width:300px; height:80px" type="text" name="message"  value="&lt;?php echo set_value('message'); ?&gt;"  /&gt;&lt;/textarea&gt;
  </code></pre>
  
  <p><strong>Error</strong></p>
  
  <pre><code>The following SMTP error was encountered: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 ko8sm6157345pbc.40
  502 5.5.1 Unrecognized command. ko8sm6157345pbc.40
  The following SMTP error was encountered: 502 5.5.1 Unrecognized command. ko8sm6157345pbc.40
  Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
  
  User-Agent: CodeIgniter
  Date: Thu, 23 Aug 2012 14:54:54 +0000
  From: 
  Return-Path: 
  To: xxxxx@gmail.com
  Subject: =?utf-8?Q?xxxxx@hotmail.com?=
  Reply-To: "hello" 
  X-Sender: hello
  X-Mailer: CodeIgniter
  X-Priority: 3 (Normal)
  Message-ID: &lt;5036443e415e4&gt;
  Mime-Version: 1.0
  
  
  Content-Type: text/plain; charset=utf-8
  Content-Transfer-Encoding: 8bit
  
  hello
  </code></pre>