osTicket/osTicket-1.8 — pull request #1263 by greezybacon (2014-09-10 15:45:55+00:00)
Title: email: Improve user identification from headers

Previously, the code would scan the email headers until it found a positive match from any of the email headers scanned. Additionally, it would attempt to find the user from the tagged email references header. However, this algorithm assumed that the references header was constant and predictable in its ordering. Recent tests with Gmail prove otherwise in some tests.

This patch changes the system so that only the tagged reference header is included in the References header, and it will scan all items in a header (namely the References header) until both the thread and a user are identified. If a user can be identified, the thread and user are returned. Otherwise, the first thread hit is returned.