Added support to In-Reply-To and References headers for sent and received ticket email replies.

Actual changes:
 * For every "ticket reply alert" sent to an user:
   * It is saved a record inside the  "ticket_email_info" table with the messageId, linking it to the originating support ticket reply
   * In-Reply-To and Refecerences headers are added to the sent mail, both set to the messageId of the latest email received from the user (if available), in order to help user email client to properly thread the ticket discussion.
 * For every incoming email, In-Reply-To header, Refecerences header and the sender email are used to lookup the existing ticket. If found, it is used as ticket where to append the reply, otherwise the standard subject ticket id lookup is performed.

That's all. It seems to work nicely, and allows to omit the ticket ID from the mail subject of support replies (as the subject alteration break gmail email threading).

I tested it with IMAP access, so I don't know if it works correctly with POP3.

Some things to review:
 * I don't know if it is correct to use the "References" header for the lookup, because it seems that it can have multiple message ids inside it. Maybe it is to split-up in order to lookup each id one at time.
 * Actually, I converted the email headers sent to the user to the text saved inside the "email info" table with a print_f function. I'm pretty sure that it needs to be improved to match the format of headers saved for incoming email :)