Web Hosting Talk







View Full Version : Emailed trouble tickets help


SeņorAmor
07-01-2004, 09:38 AM
I have noticed that several companies who have a trouble ticket system allow you to either continue the ticket discussion online or via email. How is this done exactly?

For example: John Customer has a problem and fills out a support ticket on a website. His ticket is assigned to an employee of that company who, using a randomly generated email based on the ticket number (or something similar), emails John back with a response. Each time either an email response or a response on the website is entered, it stores the information (in a database, I presume).

Now, if John wishes to see the trouble ticket history, he can simply log in to the website and see the complete conversation regardless of how the response was entered (email or the website).

How does this work?

Also, how do the auto-generated email accounts work? I figure it's just a temporary forwarder that's setup to forward to the employee's inbox, but I'm not sure.

Thanks in advance.

Corey Bryant
07-01-2004, 09:44 AM
There are some trouble ticket systems out there that support this. SmarterTicket is one of them.

Not too sure what you mean by auto-generated e-mail accounts though

SeņorAmor
07-01-2004, 09:48 AM
Ok, ever fill out a trouble ticket with a company and get an email response to it from an email addy like tickets_x34nmf94@domain.com?

Clearly they didn't have a tickets_x34nmf94 email account premade, just sitting there waiting to be used. It was auto created by the system and probably forwards all responses sent to it to an employee's email address. What I'm more interested in knowing is how to parse incoming emails sent to that address (and also emails being sent back to the customer) so that they're entered into the database to log trouble ticket history.

That make sense?

Corey Bryant
07-01-2004, 10:21 AM
I see what you mean now - but no, never got an e-mail back that way. The ticket number is usually in the subject. But the way they probably do that is it is integrated with the e-mail program & possibly have it fixed that all tickets*.domain.com go to a specific inbox

But since SmartTicket also makes SmarterMail - I do not see why that could not be incorporated into it. I am not too sure if you are looking for a PHP or ASP / .NET solution though.

Burhan
07-01-2004, 10:30 AM
The identifying key (ticket number, etc.) is included in the messages. When the script replies to a customer email, it embeds this code (usually in the headers). Scripts usually also put this in the subject/body so the customer knows what his ticket number is.

Now when a customer replies, the script reads the email message, grabs the ticket id from the header, updates the "staff" area, then emails the appropriate employee/department.

Now all information is available regardless of how its submitted. There is usually a special catch-all email address that the script is listening on. This is why you sometimes get emails like username_ticketnumber. However most scripts that I know of use headers.

SimplyDiff
07-01-2004, 10:46 AM
fyrestrtr, do you have examples of any that use headers? I'm interested in seeing how that works.

All the ones I have seen that use a non-specific ticket address put the number in the subject or body of the message and that is where they pull the id from.

I have not come across a mailer that duplicates headers from the original message in a reply, so that's why I'm wondering how the scripts use headers with any reliability (other than subject obviously).


SeņorAmor, as far as doing it. If you have your own server, you can just have the mail daemon pipe the e-mail to a process and do it that way. Otherwise you can poll a pop account every X seconds and grab any e-mails. As others have mentioned, failover accounts will work for the ticket_# addresses if you can't setup a direct pipe/filter for them.

Burhan
07-01-2004, 10:55 AM
I don't know exactly how they do it with the headers. Perhaps I'm confusing it with something else.

But I'm sure that I have seen ticket systems that don't use unique email addresses.

Pheaton
07-06-2004, 09:38 AM
It's just a simple forwarder. The email is forwarded to a php/perl/etc script, which then takes the content and parses it to output teh content.

The ticket ID is generally included in the subject or somewhere in the message, which is how the scripts knows which ticket to add the reply to.

Here's a simple php script that you can forward the email to.

#!/usr/bin/php
<?php
// read from stdin
$fd = fopen("php://stdin", "r");
$email = "";
while (!feof($fd)) {
$email .= fread($fd, 1024);
}
fclose($fd);

// handle email
$lines = explode("\n", $email);

// empty vars
$from = "";
$subject = "";
$headers = "";
$message = "";
$splittingheaders = true;

for ($i=0; $i<count($lines); $i++) {
if ($splittingheaders) {
// this is a header
$headers .= $lines[$i]."\n";

// look out for special headers
if (preg_match("/^Subject: (.*)/", $lines[$i], $matches)) {
$subject = $matches[1];
}
if (preg_match("/^From: (.*)/", $lines[$i], $matches)) {
$from = $matches[1];
}
} else {
// not a header, but message
$message .= $lines[$i]."\n";
}

if (trim($lines[$i])=="") {
// empty line, header section has ended
$splittingheaders = false;
}
}



# Add the code to execute once you have the content in $message below this


?>