[$conn CriticalSection "struct:cursor,last"] $this = $conn[($conn.cursor = $conn.last)] = [ObjectByID CREATE "net.imap.client"] [$this Connect "imaps://user@mail.wherever:993", [[ObjectByID ALIAS "auth.pki.keypair"] GetKeyByUser [ObjectByID ALIAS "auth.session" WhoAmI]]] [$this GetMessageCount "unread"] >= 0: cons.Write("You have " . [$this GetMessageCount "unread"] " new messages") [$this Disconnect]