Change last message lookup to use ticket_id instead of external ticket
id/number.

* Ticket number will be customization in the future
* Ticket thread only link to Ticket should be internal ticket id.
Require email match to thread incoming email when ticket number on subject
line is used.
Support last message lookup without setting last message id.
Merge pull request #748 from protich/feature/message-id-tracking-revisited

Message id tracking revisited

Reviewed-By: Jared Hancock <jared@osticket.com>