Found it, there seems to be a bug in the mail fetcher in 1.12.2. The connection string for the mailbox doesn't get formatted correctly when not using SSL.
For who finds this on Google, here's is how I made it work;
In the include directory of your osTicket installation, edit class.mailfetch.php. Around line 60 you'll find the Mail server string section.
I've changed it to this:
//Mail server string
$this->srvstr=sprintf('{%s:%d/%s', $this->getHost(), $this->getPort(), $this->getProtocol());
if(!strcasecmp($this->getEncryption(), 'SSL'))
$this->srvstr.='/ssl';
// Change this line to make mail fetch work again
// $this->srvstr.='/novalidate-cert}';
$this->srvstr.='/notls}';
This fix likely breaks SSL connections and should be reverted if you want to use SSL in the future, so I can't say it's a pretty fix, but it works for me and I don't want to spend much time looking into it further.
As proof of concept I made a small php script to test imap connections (i called it test.php in my users' home directory). It simply counts the nr of messages in the INBOX folder and prints it to the terminal.
<?php
$server = '{serveraddress_here:143/imap/notls}INBOX';
$imap_connection = imap_open($server, 'imap user here', 'password here');
$mailboxinfo = imap_mailboxmsginfo($imap_connection);
$messageCount = $mailboxinfo->Nmsgs;
echo $messageCount;
echo "\n";
?>
Output without "/notls" at the end of the server string
user@server:$ php test.php
PHP Warning: imap_open(): Couldn't open stream {mail.simplycode.nl:143/imap}INBOX in /home/user/test.php on line 3
PHP Warning: imap_mailboxmsginfo() expects parameter 1 to be resource, boolean given in /home/user/test.php on line 4
PHP Notice: Trying to get property 'Nmsgs' of non-object in /home/user/test.php on line 5
PHP Notice: Unknown: TLS/SSL failure for mail.simplycode.nl: SSL negotiation failed (errflg=2) in Unknown on line 0
Output with "/notls" at the end of the server string
user@server:$ php test.php
1