How can we improve WHMCS?

Share, discuss and vote for what you would like to see added to WHMCS

Forward an email to open a ticket



Many of the large ticketing systems (Zendesk, SupportPal, FreshDesk, etc.) allow the ability for an administrator/ticket operator to forward an email they receive in their personal mailbox to the ticketing system, and it will open the ticket "On Behalf" of the user who emailed them. I would like to see this ability in WHMCS for both existing and new customers who may email a staff member directly, instead of using the ticketing system.

This should take the forwarded email and open a new ticket, stripping out the "FWD" information and extracting the "from" email address, just as the other guys do.

10 Comments

Login to post a comment.

Hello Liam,

How would you go about adding that hook to WHMCS?

Thanks
This can be done via a hook. This hook should work

<?

add_hook("TicketPiping",1,"fwd_ticket_pipe");

if(!function_exists("fwd_ticket_pipe"))
{
function fwd_ticket_pipe($vars)
{
$to = $vars['to'];
$subject = $vars['subject'];

if (strpos($subject, 'Fwd:') !== false) {

$adminonly = false; // For admin only
if($numrows > 0)
{
$adminonly = true;
}

$subject = str_replace("Fwd: ", "", $vars['subject']);

$lines = explode("\n", $vars['body']);
$message = '';

for ($i=0; $i < count($lines); $i++) {
$lines[$i] = str_replace("> ","",$lines[$i]);

//Split out the sender information portion
if (preg_match("/From: (.*)<(.*)>/", $lines[$i], $matches)) {

$name = $matches[1];
$email = $matches[2];

} else {

}
if($i > 8)
{
$message .= $lines[$i].'
';
}
}

if($adminonly)
{
$numrows2 = Illuminate\Database\Capsule\Manager::table("tbladmins")->where("email","=",$vars['email'])->count();
if($numrows2 > 0)
{
logActivity('Forwarded email is sent from an admin email account. It has been imported', 0);
processPipedTicket($to, $name, $email, $subject, $message, $vars['attachments']);
} else {
logActivity('Forwarded email is not sent from an admin email account. It has NOT been imported', 0);
}

} else {
logActivity('Forwarded email is sent from a generic email account. It has been imported', 0);
processPipedTicket($to, $name, $email, $subject, $message, $vars['attachments']);
}


exit();

}

}
}
@Liam, have you thought about creating the hook, testing and putting up a link to download?
Getting this error

ArgumentCountError: Too few arguments to function processPipedTicket(), 6 passed in /home/xxxx/public_html/clientzone/includes/hooks/emailforward.php on line 57 and at least 7 expected in /home/xxxx/public_html/clientzone/includes/ticketfunctions.php:0
I get a ton of requests sent directly to me, really need this feature, otherwise I have to open a ticket manually
Struggling with this for years! Its so hard to get a user to open a ticket. They think emailing one of directly is faster when in fact a ticket is much faster.
How does this only have 13 votes? To me this is a critical addon!
yup I've tried this a few times in the past just expecting it to work. We need this.
Good feature to implement!
This is a must.