title: Cakephp E-mail Connection Office365
body: <p>I have problem with sending emails using CakePhp and Office365 SMTP server</p>
  
  <p>My configuration in cakephp looks so</p>
  
  <pre><code>'EmailTransport' =&gt; [
          'default' =&gt; [
              'className' =&gt; 'Smtp',
              // The following keys are used in SMTP transports
              'host' =&gt; 'smtp.office365.com',
              'port' =&gt; 587,
              'timeout' =&gt; 30,
              'username' =&gt; 'email',
              'password' =&gt; 'pass',
              'client' =&gt; null,
              'tls' =&gt; true,
              'url' =&gt; env('EMAIL_TRANSPORT_DEFAULT_URL', null),
          ],
      ],
  </code></pre>
  
  <p>I am getting the following error message:</p>
  
  <p>Connection timed out
  Cake\Network\Exception\SocketException</p>
  
  <p>Settings for Office365 are here <a href="https://support.office.com/en-us/article/POP-and-IMAP-settings-for-Outlook-Office-365-for-business-7fc677eb-2491-4cbc-8153-8e7113525f6c" rel="nofollow noreferrer">https://support.office.com/en-us/article/POP-and-IMAP-settings-for-Outlook-Office-365-for-business-7fc677eb-2491-4cbc-8153-8e7113525f6c</a></p>
  
  <p>I have tried with timeout to 60 secs, port 25, and with tls:// prefix but it is the same error.</p>
  
  <p>Thx</p>