public function readMailBox($connection, $msg) { $other = array(); $headers = imapRoutine::extractHeaderData(imap_header($connection, $msg)); $enc = imapRoutine::getParams(imap_fetchstructure($connection, $msg)); $other['ticketID'] = imapRoutine::getTicketID($headers['subject'], $headers['email']); $other['body'] = imapRoutine::getMessageBody($msg, $connection); // Attempt to clean out some of the quoted data.. $other['body'] = preg_replace('/(^\\w.+:\\n)?(^>.*(\\n|$))+/mi', '', $other['body']); return array_merge($headers, $enc, $other); }