I'm trying to track down what this does:

            $messageID = $headers["message-id"];
            if ($messageID) $messageID = substr(substr($messageID, 1), 0, strlen($messageID)-2);
            else $messageID = "mid:".$id;
            $result[$id]->messageID = $messageID;
            }

I see $messageID in a lot of places, while I see messageID(without a variable $ identifier) in other places.

What is "messageID" for?

Found in:
/public_html/webmail/program/lib/imap.inc
/public_html/webmail/program/steps/addressbook/func.inc    $message_id = $headers->messageID;
/public_html/webmail/program/steps/mail/compose.inc        $_SESSION['compose']['reply_msgid'] = $REPLY_MESSAGE['headers']->messageID;
/public_html/webmail/program/steps/mail/func.inc        $message_id = $headers->messageID;