title: Smtp Codeigniter 3
body: <p>In order to train me on codeigniter I decided to set up an application protected by login password.
  In case of password lost I have a function of confirmation by mail. but there...</p>
  
  <blockquote>
    <p>220 smtp.gmail.com ESMTP j39-v6sm10096073wre.44 - gsmtp</p>
    
    <p>hello: 250-smtp.gmail.com at your service, [86.236.5.51]</p>
    
    <p>250-SIZE 35882577</p>
    
    <p>250-8BITMIME</p>
    
    <p>250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH</p>
    
    <p>250-ENHANCEDSTATUSCODES</p>
    
    <p>250-PIPELINING</p>
    
    <p>250-CHUNKING</p>
    
    <p>250 SMTPUTF8</p>
    
    <p>from: 250 2.1.0 OK j39-v6sm10096073wre.44 - gsmtp</p>
    
    <p>to: 250 2.1.5 OK j39-v6sm10096073wre.44 - gsmtp</p>
    
    <p>data: 354  Go ahead j39-v6sm10096073wre.44 - gsmtp</p>
    
    <p>quit: </p>
    
    <p>L'erreur SMTP suivante s'est produite : </p>
    
    <p>L'erreur SMTP suivante s'est produite : </p>
    
    <p>Impossible d'envoyer des emails avec la méthode SMTP de PHP. Votre serveur ne 
    doit pas être configuré pour pouvoir utiliser cette méthode.</p>
    
    <p>Date: Sun, 19 Aug 2018 08:51:39 +0000</p>
    
    <p>From: </p>
    
    <p>Return-Path: </p>
    
    <p>To: tony.amprou@gmail.com</p>
    
    <p>Subject: =?UTF-8?Q?\r=20test?=</p>
    
    <p>Reply-To: </p>
    
    <p>User-Agent: CodeIgniter</p>
    
    <p>X-Sender: tony.amprou@gmail.com</p>
    
    <p>X-Mailer: CodeIgniter</p>
    
    <p>X-Priority: 3 (Normal)</p>
    
    <p>Message-ID: &lt;5b792f9b817d1@gmail.com></p>
    
    <p>Mime-Version: 1.0</p>
    
    <p>Content-Type: text/plain; charset=UTF-8</p>
    
    <p>Content-Transfer-Encoding: 8bit</p>
    
    <p>Bonjour</p>
  </blockquote>
  
  <p>I do not understand the mistake I could make. Here is my code.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>public function oubli() 
   {
   $this-&gt;load-&gt;helper("form");
   $this-&gt;load-&gt;library('form_validation');
    $this-&gt;form_validation-&gt;set_rules('mail','mail','trim|required');
    if($this-&gt;form_validation-&gt;run() ==false) 
    {
     $this-&gt;load-&gt;view('login/oubli');
    }
    else
    { 
    $mail = $this-&gt;input-&gt;post('mail');
    $this-&gt;auth_user-&gt;oubli_pass($mail);
    $nombre = $this-&gt;auth_user-&gt;nombre;
     if($nombre == '1') 
     {
           $this-&gt;load-&gt;library('email');
           $this-&gt;config-&gt;load('email', TRUE);
           $this-&gt;email-&gt;initialize($this-&gt;config-&gt;item('email'));
           $this-&gt;email-&gt;from('tony.amprou@gmail.com');
           $this-&gt;email-&gt;to($this-&gt;input-&gt;post('mail'));
           $this-&gt;email-&gt;subject('test');
           $this-&gt;email-&gt;message('Bonjour');
            if($this-&gt;email-&gt;send())
            {
            $data['result_class'] = "alert-success";
            $data['result_message'] ="Un email de reinitialisation vient de vous etre envoyé";
      }
      else
      {
      $data['result_class'] = "alert-danger";
               $data['result_message'] = "Votre message n'a pas pu être envoyé. Nous mettons tout en oeuvre pour résoudre le problème.";
               $data['result_message'] .= "&lt;pre&gt;\n";
               $data['result_message'] .= $this-&gt;email-&gt;print_debugger();
               $data['result_message'] .= "&lt;/pre&gt;\n";
               $this-&gt;email-&gt;clear(); 
      }
     $this-&gt;load-&gt;view('login/oubli_result', $data);
     }
     else
     {
      $data['mail_error'] = "L'adresse mail est inconnu";
      $this-&gt;load-&gt;view('login/oubli', $data); 
     }
  
    }
   }</code></pre>
  </div>
  </div>
  </p>
  
  <p>And my config files ...</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
  defined('BASEPATH') OR exit('No direct script access allowed');
  
  $config['protocol']  = "smtp";
  $config['smtp_host'] = "smtp.gmail.com";
  $config['smtp_user'] = "tony.amprou@gmail.com";
  $config['smtp_pass'] = "MON MOT DE PASSE";
  $config['smtp_port'] = '465';
  $config['charset']   = 'utf-8';
  $config['newline']   = '\r\n';
  $config['crlf']   = '\n';
  $config['mailtype']  = 'text';
  $config['starttls']  =  'true';
  $config['smtp_crypto'] = "ssl";
  $config['ssl'] = "ssl";</code></pre>
  </div>
  </div>
  </p>