title: Can't send Email with Outlook SMTP using PhpMailer and Codeigniter
body: <p>Whenever i try to send an E-mail (outlook SMTP) using: Phpmailer i get this error:</p>
  
  <pre><code>2020-06-05 18:45:05 Connection: opening to smtp.office365.com:587, timeout=300, options=array()
  2020-06-05 18:45:05 Connection: opened
  2020-06-05 18:45:05 SERVER -&gt; CLIENT: 220 AM0PR10CA0059.outlook.office365.com Microsoft ESMTP MAIL Service ready at Fri, 5 Jun 2020 18:45:05 +0000
  2020-06-05 18:45:05 SERVER -&gt; CLIENT: 250-AM0PR10CA0059.outlook.office365.com Hello [82.165.86.40]250-SIZE 157286400250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-STARTTLS250-8BITMIME250-BINARYMIME250-CHUNKING250 SMTPUTF8
  2020-06-05 18:45:05 CLIENT -&gt; SERVER: STARTTLS
  2020-06-05 18:45:05 SERVER -&gt; CLIENT: 220 2.0.0 SMTP server ready
  2020-06-05 18:45:05 SERVER -&gt; CLIENT: 250-AM0PR10CA0059.outlook.office365.com Hello [82.165.86.40]250-SIZE 157286400250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-AUTH LOGIN XOAUTH2250-8BITMIME250-BINARYMIME250-CHUNKING250 SMTPUTF8
  2020-06-05 18:45:05 CLIENT -&gt; SERVER: AUTH LOGIN
  2020-06-05 18:45:05 SERVER -&gt; CLIENT: 334 VXNlcm5hbWU6
  2020-06-05 18:45:05 CLIENT -&gt; SERVER: [credentials hidden]
  2020-06-05 18:45:05 SERVER -&gt; CLIENT: 334 UGFzc3dvcmQ6
  2020-06-05 18:45:05 CLIENT -&gt; SERVER: [credentials hidden]
  2020-06-05 18:45:10 SERVER -&gt; CLIENT: 535 5.7.3 Authentication unsuccessful [AM0PR10CA0059.EURPRD10.PROD.OUTLOOK.COM]
  2020-06-05 18:45:10 SMTP ERROR: Password command failed: 535 5.7.3 Authentication unsuccessful [AM0PR10CA0059.EURPRD10.PROD.OUTLOOK.COM]
  SMTP Error: Could not authenticate.
  2020-06-05 18:45:10 CLIENT -&gt; SERVER: QUIT
  2020-06-05 18:45:10 SERVER -&gt; CLIENT: 221 2.0.0 Service closing transmission channel
  2020-06-05 18:45:10 Connection: closed
  SMTP Error: Could not authenticate.
  </code></pre>
  
  <p>I tried with Codeigniter  as well</p>
  
  <pre><code>Failed to authenticate password. Error:
  Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
  </code></pre>
  
  <p>i tried both way but not working ...</p>
  
  <p>i am using codeigniter default mail class </p>
  
  <p>here is the config:</p>
  
  <pre><code>        $config = array(
  
              'smtp_crypto'  =&gt; 'tls', or 'startTls'
              'smtp_auth'  =&gt; true,
              'protocol'  =&gt; 'smtp',
              'smtp_host' =&gt; 'smtp.office365.com',
              'smtp_port' =&gt; 587,
              'smtp_timeout' =&gt; '7',
              'smtp_user' =&gt; 'email@account.com',
              'smtp_pass' =&gt; 'emailPassword', or 'APPPASSWORD'
              'mailtype'  =&gt; 'html',
              'charset'   =&gt; 'iso-8859-1',
              'wordwrap'  =&gt; TRUE,
              'validation'   =&gt; TRUE
          );
  
  </code></pre>
  
  <p>This is the Phpmailer Config:</p>
  
  <pre><code>$mail-&gt;isSMTP();
  $mail-&gt;Host     = 'smtp.office365.com';
  $mail-&gt;SMTPAuth = false;
  $mail-&gt;Username = 'email@account.com';
  $mail-&gt;Password = 'emailPassword'; or 'APPPASSWORD'
  $mail-&gt;SMTPSecure = 'tls', or 'startTls',
  $mail-&gt;Port     =  587
  
  </code></pre>
  
  <p>anybody faced with type of problem ?
  Looking for some help !!!</p>