title: how to correct way to send email using codeigniter
body: <p>Hey guy, I'm trying to send email using codeiginiter mail class function, but I found a trouble with smtp protocol. I using gmail smtp protocol. 
  I running this in local machine.
  I'm using Xampp 1.7.4 package, andI have tried setting like below :</p>
  
  <pre><code>function index()
  {
  
      $config['protocol'] = 'smtp'; // mail, sendmail, or smtp    The mail sending protocol.
      $config['smtp_host'] = 'smtp.gmail.com'; // SMTP Server Address.
      $config['smtp_user'] = 'me@gmail.com'; // SMTP Username.
      $config['smtp_pass'] = '123'; // SMTP Password.
      $config['smtp_port'] = '25'; // SMTP Port.
      $config['smtp_timeout'] = '5'; // SMTP Timeout (in seconds).
      $config['wordwrap'] = TRUE; // TRUE or FALSE (boolean)    Enable word-wrap.
      $config['wrapchars'] = 76; // Character count to wrap at.
      $config['mailtype'] = 'html'; // text or html Type of mail. If you send HTML email you must send it as a complete web page. Make sure you don't have any relative links or relative image paths otherwise they will not work.
      $config['charset'] = 'utf-8'; // Character set (utf-8, iso-8859-1, etc.).
      $config['validate'] = FALSE; // TRUE or FALSE (boolean)    Whether to validate the email address.
      $config['priority'] = 3; // 1, 2, 3, 4, 5    Email Priority. 1 = highest. 5 = lowest. 3 = normal.
      $config['crlf'] = "\r\n"; // "\r\n" or "\n" or "\r" Newline character. (Use "\r\n" to comply with RFC 822).
      $config['newline'] = "\r\n"; // "\r\n" or "\n" or "\r"    Newline character. (Use "\r\n" to comply with RFC 822).
      $config['bcc_batch_mode'] = FALSE; // TRUE or FALSE (boolean)    Enable BCC Batch Mode.
      $config['bcc_batch_size'] = 200; // Number of emails in each BCC batch.
  
      $this-&gt;load-&gt;library('email');
      $this-&gt;email-&gt;initialize($config);
  
  
      $this-&gt;email-&gt;from('me@gmail.com', 'Me');
      $this-&gt;email-&gt;reply_to('me@gmail.com', 'Me');
      $this-&gt;email-&gt;to('you@yahoo.com');
      $this-&gt;email-&gt;subject('testing my mail function with CodeIgniter');
      $this-&gt;email-&gt;message('&lt;html&gt;&lt;body&gt;this is the content&lt;/body&gt;&lt;/html&gt;');
  
      if ( ! $this-&gt;email-&gt;send()){
          echo 'error! &lt;br /&gt;';
          // Generate error
      }
      echo $this-&gt;email-&gt;print_debugger();
  
  }
  </code></pre>
  
  <p>and below error was show in my browser :</p>
  
  <pre><code>error!
  220 mx.google.com ESMTP b8sm581192pbj.46
  
  hello: 250-mx.google.com at your service, [118.96.231.25]
  250-SIZE 35882577
  250-8BITMIME
  250-STARTTLS
  250 ENHANCEDSTATUSCODES
  
  Failed to send AUTH LOGIN command. Error: 530 5.7.0 Must issue a STARTTLS command first. b8sm581192pbj.46
  
  from: 530 5.7.0 Must issue a STARTTLS command first. b8sm581192pbj.46
  
  The following SMTP error was encountered: 530 5.7.0 Must issue a STARTTLS command first. b8sm581192pbj.46
  
  to: 530 5.7.0 Must issue a STARTTLS command first. b8sm581192pbj.46
  
  The following SMTP error was encountered: 530 5.7.0 Must issue a STARTTLS command first. b8sm581192pbj.46
  
  data: 530 5.7.0 Must issue a STARTTLS command first. b8sm581192pbj.46
  
  The following SMTP error was encountered: 530 5.7.0 Must issue a STARTTLS command first. b8sm581192pbj.46
  502 5.5.1 Unrecognized command. b8sm581192pbj.46
  The following SMTP error was encountered: 502 5.5.1 Unrecognized command. b8sm581192pbj.46
  Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
  
  User-Agent: CodeIgniter
  Date: Wed, 1 Jun 2011 09:27:21 +0700
  From: "Me" 
  Return-Path: 
  Reply-To: "Me" 
  To: you@yahoo.com
  Subject: =?utf-8?Q?testing_my_mail_function_with_CodeIgniter?=
  X-Sender: me@gmail.com
  X-Mailer: CodeIgniter
  X-Priority: 3 (Normal)
  Message-ID: &lt;4de5a38938720@gmail.com&gt;
  Mime-Version: 1.0
  
  
  Content-Type: multipart/alternative; boundary="B_ALT_4de5a38938733"
  
  This is a multi-part message in MIME format.
  Your email application may not support this format.
  
  --B_ALT_4de5a38938733
  Content-Type: text/plain; charset=utf-8
  Content-Transfer-Encoding: 8bit
  
  this is the content
  
  
  --B_ALT_4de5a38938733
  Content-Type: text/html; charset=utf-8
  Content-Transfer-Encoding: quoted-printable
  
  &lt;html&gt;&lt;body&gt;this is the content&lt;/body&gt;&lt;/html&gt;
  
  --B_ALT_4de5a38938733--
  </code></pre>