title: CodeIgniter send SMTP Gmail
body: <p>Hey guys I'm trying to create a reset password for this forum I'm developing.... Anyway I followed a bunch of guides and tried many versions of what you will see and this is the one with the least errors.... Still I can't figure out what's wrong, I could use your help please.</p>
  
  <pre><code>class CI_Email {  //in library email.php
  
  var $useragent      = "CodeIgniter";
  var $mailpath       = "/usr/sbin/msmtp";    // Sendmail path
  var $protocol       = "smtp";   // mail/sendmail/smtp
  var $smtp_host      = "smtp.googlemail.com";        // SMTP Server.
  var $smtp_user      = "mymail@gmail.com";       // SMTP Username
  var $smtp_pass      = "mypass";     // SMTP Password
  var $smtp_port      = "465";        // SMTP Port
  var $smtp_timeout   = 5;        // SMTP Timeout in seconds
  var $smtp_crypto    = "";       // SMTP Encryption. Can be null, tls or ssl.
  var $mailtype       = "html";   // text/html  Defines email formatting
  var $charset        = "utf-8";  // Default char set: iso-8859-1 or us-ascii
  </code></pre>
  
  <p>And this is the result:<pre>hello: 
  The following SMTP error was encountered: 
  Failed to send AUTH LOGIN command. Error: 
  from: 
  The following SMTP error was encountered: 
  to: 
  The following SMTP error was encountered: 
  data: 
  The following SMTP error was encountered: </p>
  
  <p>The following SMTP error was encountered: 
  Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
  Content-Type: multipart/alternative; boundary="B_ALT_51cd96f2daf24"</p>
  
  <p>This is a multi-part message in MIME format.
  Your email application may not support this format.</p>
  
  <p>--B_ALT_51cd96f2daf24
  Content-Type: text/plain; charset=utf-8
  Content-Transfer-Encoding: 8bit</p>
  
  <p>My text here...</p>
  
  <p>--B_ALT_51cd96f2daf24
  Content-Type: text/html; charset=utf-8
  Content-Transfer-Encoding: quoted-printable
  </pre></p>
  
  <p>I also tried a lot of other config i found online such as:</p>
  
  <pre><code>    var $mailpath      = "/usr/sbin/sendmail";    // Sendmail path 
      var $smtp_host     = "ssl://smtp.googlemail.com";        // SMTP Server.
  </code></pre>
  
  <p>or:</p>
  
  <pre><code>    var $mailpath      = "/usr/sbin/sendmail";    // Sendmail path
      var $smtp_host     = "ssl://smtp.gmail.com";        // SMTP Server.
  </code></pre>
  
  <p>With SSL protocol in <code>smtp_host</code> I was getting an endless screen of countless errors.</p>