CodeIgniter email sending error
<p>I am trying to send email with CodeIgniter here is my code</p>

<pre><code>function sendmail()
    {
            // Set SMTP Configuration
            $emailConfig = array(
               'protocol' =&gt; 'smtp',
                'smtp_host' =&gt; 'TLS://smtp.googlemail.com',
                'smtp_port' =&gt; 587,
                'smtp_user' =&gt; 'email@gmail.com',
                'smtp_pass' =&gt; '******',
                'mailtype'  =&gt; 'html',
                'charset'   =&gt; 'iso-8859-1'
            );

            // Set your email information
            $from = array('email' =&gt; 'frommail@gmail.com', 'name' =&gt; 'Your Name');
            $to = array('mymail@gmail.com');
            $subject = 'Your gmail subject here';

            $message = 'Type your gmail message here';
            // Load CodeIgniter Email library
            $this-&gt;load-&gt;library('email', $emailConfig);

            // Sometimes you have to set the new line character for better result
            $this-&gt;email-&gt;set_newline("rn");
            // Set email preferences
            $this-&gt;email-&gt;from($from['email'], $from['name']);
            $this-&gt;email-&gt;to($to);

            $this-&gt;email-&gt;subject($subject);
            $this-&gt;email-&gt;message($message);
            // Ready to send email and check whether the email was successfully sent

            if (!$this-&gt;email-&gt;send()) {
                // Raise error message
                show_error($this-&gt;email-&gt;print_debugger());
            }
            else {
                // Show success notification or other things here
                echo 'Success to send email';
            }

    }
</code></pre>

<p>but it gives me this type of error </p>

<blockquote>
  <p>The following SMTP error was encountered: 110 Connection timed out
  Unable to send data: AUTH LOGIN Failed to send AUTH LOGIN command.
  Error: Unable to send data: MAIL FROM:</p>
  
  <p>from: </p>
  
  <p>The following SMTP error was encountered: Unable to send data: RCPT
  TO:</p>
  
  <p>to: </p>
  
  <p>The following SMTP error was encountered: Unable to send data: DATA</p>
  
  <p>data: </p>
  
  <p>The following SMTP error was encountered: Unable to send data:
  User-Agent: CodeIgniter Date: Fri, 29 Jan 2016 06:59:14 +0000 From:
  "Alex Tester" Return-Path: To: coderjack9@gmail.com Subject:
  =?iso-8859-1?Q?Email_Test?= Reply-To: "alextester1003@gmail.com" X-Sender: alextester1003@gmail.com X-Mailer: CodeIgniter X-Priority: 3
  (Normal) Message-ID: &lt;56ab0dc2af7ad@gmail.com> Mime-Version: 1.0
  Content-Type: multipart/alternative; boundary="B_ALT_56ab0dc2af809"
  This is a multi-part message in MIME format. Your email application
  may not support this format. --B_ALT_56ab0dc2af809 Content-Type:
  text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Testing
  the email class. --B_ALT_56ab0dc2af809 Content-Type: text/html;
  charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Testing
  the email class.
  --B_ALT_56ab0dc2af809-- Unable to send data: .</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.</p>
</blockquote>