I know this thread is a bit old but I have found a solution to my issue which is about the same as all of the above. I had searched for days trying to find an answer. I could not connect to office365 from my webhost. It wasn't that anyone was blocking the ports. It has to do with PHP 5.6. It has built in security that doesn't allow you to basically send from one system to another insecurely. What you have to do is install a security certificate on your webspace/domain. I was just able to use a free "Lets Encrypt" certificate. Once installed, PHP 5.6 was happy and was then able to send email out through office365. The cpanel on my host has the ability to install a "Lets Encrypt" certificate automatically from cpanel under the security section and that did the trick.Once you have all of the DNS entries that office365 wants you to enter to send email from your domain through them, do this...After security certificate is installed (described above), for osticket under "sending email via SMTP" , use your domain name as the email server name, port 587, authentication required = no.The lack of a security certificate was the main big issue that was causing PHP5.6 to abort the connection to the office365 server.