title: Failed to authenticate password using codeigniter and gmail
body: <p>I know this question has been asked before. I have worked through the answers, but I'm still getting a 'Failed to authenticate password. Error: 535-5.7.8' error message.
  My code:</p>
  
  <pre><code>$config = array(
      'protocol'  =&gt; 'smtp',
      'smtp_host' =&gt; 'ssl://smtp.googlemail.com',
      'smtp_port' =&gt; 465,
      'smtp_user' =&gt; 'mygmail@gmail.com',
      'smtp_pass' =&gt; '********',
      'mailtype'  =&gt; 'text',
      'charset'   =&gt; 'iso-8859-1',
  );
  $this-&gt;load-&gt;library('email', $config);
  $this-&gt;email-&gt;set_newline("\r\n");
  $this-&gt;email-&gt;from('fromgmail@gmail.com', 'My Name');
  $this-&gt;email-&gt;to('mygmail@gmail.com');
  $this-&gt;email-&gt;subject('Email Test');
  $this-&gt;email-&gt;message('Testing Codeigniter E-mail Library.');
  $this-&gt;email-&gt;send();
  
  echo $this-&gt;email-&gt;print_debugger();
  </code></pre>
  
  <p>This returns the following error message:</p>
  
  <pre><code>220 smtp.googlemail.com ESMTP x64sm5635644wrb.10 - gsmtp
  
  hello: 250-smtp.googlemail.com at your service, [89.238.188.204]
  250-SIZE 35882577
  250-8BITMIME
  250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
  250-ENHANCEDSTATUSCODES
  250-PIPELINING
  250-CHUNKING
  250 SMTPUTF8
  
  Failed to authenticate password. Error: 535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials x64sm5635644wrb.10 - gsmtp
  Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
  
  User-Agent: CodeIgniter
  Date: Thu, 18 May 2017 08:36:24 +0000
  From: "My Name" &lt;fromgmail@gmail.com&gt;
  Return-Path: &lt;fromgmail@gmail.com&gt;
  To: mymail@gmail.com
  Subject: =?ISO-8859-1?Q?=41=73=68=20=48=69=6E=69=6E=67=20=46=61=72=6D=20=45=6E=71?= =?ISO-8859-1?Q?=75=69=72=79?=
  Reply-To: "fromgmail@gmail.com" &lt;fromgmail@gmail.com&gt;
  X-Sender: fromgmail@gmail.com
  X-Mailer: CodeIgniter
  X-Priority: 3 (Normal)
  Message-ID: &lt;591d5d088406c@gmail.com&gt;
  Mime-Version: 1.0
  
  Content-Type: text/plain; charset=ISO-8859-1
  Content-Transfer-Encoding: 8bit
  </code></pre>
  
  <p>I have checked the username and password for my google account and know that they are correct.</p>