SMTP connection error?

Hello!
I can’t use NextCloud’s mailing feature due to SMTP error.
For now i understand, that there is some problem with sertificates…

Much thanks,
Peeter.

Nextcloud version: 14.0.6
Operating system and version: Ubuntu server 16.04.5
Apache or nginx version: Apache 2.4.18
PHP version: 7.1.25

The output of SEND EMAIL error report:

A problem occurred while sending the email. Please revise your settings. (Error: Connection could not be established with host smtp.office365.com [ #0] Log data: ++ Starting Swift_SmtpTransport !! Connection could not be established with host smtp.office365.com [ #0] (code: 0))

The output of config.php file in /path/to/nextcloud:

<?php
$CONFIG = array (
  'instanceid' => 'o0uthz',
  'passwordsalt' => 'YLwOs7Y8JRr',
  'secret' => 'uvHYhPx3WnQpbQxj',
  'trusted_domains' =>
  array (
    0 => 'cloud.asd.com',
  ),
  'datadirectory' => '/var/www/html/nextcloud/data',
  'overwrite.cli.url' => 'https://cloud.asd.com',
  'dbtype' => 'mysql',
  'version' => '14.0.6.0',
  'dbname' => 'nexasdd',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextasdr',
  'dbpassword' => 'asdasdasd',
  'logtimezone' => 'UTC',
  'installed' => true,
  'updater.release.channel' => 'stable',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'mail_smtpmode' => 'smtp',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'mail_smtphost' => 'smtp.office365.com',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpport' => '587',
  'mail_from_address' => 'cloud',
  'mail_domain' => 'domain.com',
  'mail_smtpdebug' => true,
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'name@name.com',
  'mail_smtppassword' => '********',
  'mail_smtpsecure' => 'ssl',
);