I'm running into a similar issue with SMTP not connecting. IMAP connects without issue.
Error Message: Failed to connect to smtp.google.com:587 [SMTP: Failed to connect socket: Connection timed out (code: -1, response: )]
osTicket 1.16 on Ubuntu
PHP 8.0.16
Is there the full list of extensions required for php? I rolled back from 8.1 to 8.0 per this thread's advice and reinstalled many of them but may be missing something.