PHP - Store Conversation Thread Allow Response Via Email or on Web
I'm working on a helpdesk/usermanagement tool for my boss and I'm trying to get my head around the best way to accomplish the following:
The help desk will allow users to ask a question. The question can either be asked after they have logged into their online account (think like a private message on a forum). Or they should have the option to send their question to a specific email address i.e. email@example.com.
Once the request comes in it should be stored in the mysql table with the associated question id. Then it will be assigned to an employee and they can reply to the person with the answer to their question.
In my head, all of the above is very easy to do if it is kept all online (i.e. they can only utilize the help desk if they are logged into their account on our site). However, we need to bring the conversation to their inbox.
So ideally, if one of the techs responds the response should show up in their online web message account AND send an email to their email address.
Then the user should have the choice to click "reply" in the email and send their response. That response should then be added to the mysql table and become part of the threaded conversation. If the user attaches an attachment then that attachment should be moved to a folder on the webserver and the attachment's link should be stored in an attachment column for that reply's row in the mysql table. Essentially the web messages and email conversations need to stay synchronized.
Any resources/code examples/or theory of how best this would be accomplished would be much appreciated.
As an aside, the current web app is written with CodeIgniter2 with a MySQL backend.