Okay, this code \'was\' working perfectly and then I started playing around with it in order to let others connect to their e-mails and as you do ran into a few open stream
resource imap_open( string $mailbox , string $username , string $password [, int $options = 0 [, int $n_retries = 0 [, array $params = NULL ]]] )