Tracking received emails like basecamp or github

I have an application which I configured to send and receive email. Both
processes work at the basic level. The application can send email to
users. Users can send email back to the application where I use the
mail_fetcher plugin to poll the inbox.

My problem is i am trying to determine the best way to ‘track’ these
emails so that when they are retrieved from the mail server I can
process them correctly.

For example:

Application can send email to a user so that user can reply and update a
message on a specific web page in the application. At this point i need
to know the message id when the email is sent from the app so i can
persist it and use it as cross-reference when the reply comes back (in
the case of a threaded message situation).

Ive tried setting custom header parameters but these get stripped coming
back from the user.

Should i simply use some form of unique identifier on the subject line?
reply-to? (although i would assume this would require dynamic email
inboxes), or in the message body itself?

I have searched everywhere and am even looking for other open source
apps that do this so i can understand a clean way to proceed. Any help
would be most appreciated.

J