Avatar of w00tw00t111
w00tw00t111

asked on 

PHP - Store Conversation Thread Allow Response Via Email or on Web

Hello Experts,

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. support@ourdomain.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.

Thank you!
PHPMySQL Server

Avatar of undefined
Last Comment
Matt
ASKER CERTIFIED SOLUTION
Avatar of Matt
Matt
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of johanntagle
johanntagle
Flag of Philippines image

I'd like to answer this from another angle - do you really need to build one from scratch?  Check this out: http://www.opensourcehelpdesklist.com/

The ability to receive responses via email is nothing new - I'm sure many of the those listed in that website has it.  They may not have the exact functionality you want, but they are open source - you can modify them then just link to your current web app.
Avatar of w00tw00t111
w00tw00t111

ASKER

Thank you both for your responses. Johann, I'll definitely be taking a look at some of those open source options. The thought was since the rest of the app is written with a mvc structure in code igniter it would be easiest (going forward and in the future) for the BI necessary for the help desk and the help desk to be written with the same coding structure.

Matt, that's essentially exactly what we were looking for with the email being sent to a php script. Do I presume correctly that the script could be written that if ticket is not found in the subject box that a new ticket would be created for that user (which could be determined based on their email address).

The HTML body of the email messages/instant messages should these just be stored as a text field in mysql?
Avatar of Matt
Matt
Flag of United Kingdom of Great Britain and Northern Ireland image

Hi

Yes you could store the html body as a text field in the database. You may need to check the email to see if there is an attachment and strip that out first. I'm not sure how to do this but set the script up, send it an email that has an attachment and code the script so that it saves the email to a text file then look at the email structure in the text file to see how to parse it.

Yes you are thinking along the right lines about creating a new ticket. If the ticket id is not found in the subject, identify the user by their email address and create a new ticket.

Or if you can't identify them from their email send them an email back saying they don't appear to be registered etc. Of create them a new account it depends on your requirements.

Cheers

Avatar of w00tw00t111
w00tw00t111

ASKER

Got it! Thanks Matt.

One of the help desks that we were demo-ing used an interesting method for detecting current tickets vs new tickets. Unfortunately, this was the only interesting thing about the software, everything else didn't meet our needs :/

You could send an email to support@domain.com and a ticket would be created between you and the sender (whether they were registered or not). However, if a ticket was already created the email address was: support+t{x}@domain.com
Where {x} = the ticket number.
What this allowed to have happen is that the subject box could be changed, or whatever you wanted but it was still kept under the same ticket id.

What I'm not understanding is how do they establish the new email address? I.e. each new ticket has a new email.
Ex:
support+t1@domain.com for Ticket: 1
support+t102@domain.com for Ticket 102
Etc..

Can a script be loaded on the mail server to strip out the + and whatever comes after it and deliver the message to everything to the left of the "+"?
From what I know of domain servers and mail servers, the email should never even reach the domain should it?
Avatar of Matt
Matt
Flag of United Kingdom of Great Britain and Northern Ireland image

Hi

I'm not too sure about this but on one of my previous hosts I could set up a default email. Then any incoming email on my domain that didn't exactly match a mailbox was delivered to the default address.

Then you could possibly configure the script at this default address to read the emails, chech the original to address and identify the ticket number.

I would check with your host if it is possible to configure your email system in this way as I wouldn't have a clue how it is done.

Sounds an interesting way to do it though.

Cheers

Matt
Avatar of Matt
Matt
Flag of United Kingdom of Great Britain and Northern Ireland image

Hi w00t,

Thanks for the points.

Cheers

Matt
PHP
PHP

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo