Identify issue id from mail header(Message-ID and References fields)

I have implemented this by storing the message-id in a database table and comparing it with the References field of the incoming mail. Please review.