Mail App not working

Hello,
Recently I deployed Nextcloud 22.1.1 on a server. all worked except I cannot get the mail client working. I have tested the logi credentials and verified it works. But for some reason I keep getting: “Unexpected error during account creation”
Here is the Error I am getting in 22.1.1
{“reqId”:“cg9N65CSTDAtIfTsv1sZ”,“level”:3,“time”:“2021-09-02T14:17:59+00:00”,“remoteAddr”:“47.199.164.177”,“user”:“errol”,“app”:“mail”,“method”:“POST”,“url”:"/index.php/apps/mail/api/accounts",“message”:“Creating account failed: Connection to SMTP at smtp.office365.com:587 failed. Error connecting to SMTP server.”,“userAgent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36 Edg/92.0.902.84”,“version”:“22.1.1.2”,“id”:“6130dd2f596c1”}
[mail] Error: Creating account failed: Connection to SMTP at smtp.office365.com:587 failed. Error connecting to SMTP server.
POST /index.php/apps/mail/api/accounts
from 47.199.164.177 by errol at 2021-09-02T14:17:59+00:00

Works fine in: NextCloud 20.0.6
I also have NextCloud 20.0.6 running with the same email, same exact settings and it works fine. In 20.0.6 I deleted the mail and set it up and reconfigured it and it works fine.
Can you give me any advice?
Errol…