Page 1 of 1
Email piping not allowing multiple emails or CC
Posted: Thu Jan 17, 2013 9:38 pm
by dllong
Script URL: lan
Version of script: 2.4.2
Hosting company: lan
URL of phpinfo.php: na
URL of session_test.php: na
What terms did you try when SEARCHING for a solution: multiple address, cc, carbon copy
Write your message below:
Sorry for yet another question, but this one might actually be the last one. I am using email piping and it is working great, however, when a customer sends an email to our ticketing system and they have multiple emails on the line and ones on CC, none of them are being added to the email.
The reason for this, is that numerous customers will send us support requests, and put other people in copy on the request.
Can you suggest how I could go about adding this functionality?
Thanks so much.
Re: Email piping not allowing multiple emails or CC
Posted: Fri Jan 18, 2013 5:31 pm
by Klemen
I'm afraid this would require several changes to the code and the way HESK behaves.
I plan to add such functionality to HESK (don't ask when

), but if you need in sooner than officially released I'm afraid you will need to hire a developer to help you out as customizations of such extent are out of the scope of my support.
Re: Email piping not allowing multiple emails or CC
Posted: Thu Apr 11, 2013 1:19 pm
by adrfazenda
Hi everyone!
I have made this customization to my Hesk and... well... it works. Actually, sometimes Hesk is opening a new ticket on replies. I'm still working on it and soon that I trace the problem I'll post here the solution.
To add this functionality the Hesk you have to edit file "/inc/pipe_functions.inc.php". Copy and paste the code between "STARTS HERE" and "ENDS HERE" to the function hesk_email2ticket.
Code: Select all
function hesk_email2ticket($results, $pop3 = 0)
{
global $hesk_settings, $hesklang, $hesk_db_link, $ticket;
// Process "From:" email
$tmpvar['email'] = hesk_validateEmail($results['from'][0]['address'],'ERR',0);
// "From:" email missing or invalid?
if ( ! $tmpvar['email'] )
{
return NULL;
}
### CUSTOMIZATION STARTS HERE ###
// Processa o campo "Cc:"
foreach ($results['cc'] as $c => $cc)
{
// verifica se o campo é válido
$tmpvar['cc'] = hesk_validateEmail($cc['address'],'ERR',0);
// Se o campo "Cc" foi preenchido adiciona no campo de emails
if ( $tmpvar['cc'] )
{
$tmpvar['email'] = $tmpvar['email'] . ',' . $tmpvar['cc'];
}
}
### CUSTOMIZATION ENDS HERE ###
// Process "From:" name, set to "[Customer]" if not set
$tmpvar['name'] = hesk_input($results['from'][0]['name']) or $tmpvar['name'] = $hesklang['pde'];
// Process "To:" email (not yet implemented, for future use)
// $tmpvar['to_email'] = hesk_validateEmail($results['to'][0]['address'],'ERR',0);
I hope I've helped.
-- EDIT
I forgot to say this customization just works to the field CC.

Re: Email piping not allowing multiple emails or CC
Posted: Fri Apr 12, 2013 2:50 pm
by Klemen
Thanks for sharing!
Re: Email piping not allowing multiple emails or CC
Posted: Thu Apr 18, 2013 4:38 pm
by adrfazenda
Hi everyone!
I've made an improvement to the email parser.
My beloved users started to send tickets using the Hesk email address on CC: field and putting anyone else on TO: field. Result: some (important) people were missing to receive tickets solutions.
With this improvement users can use both CC: and TO: fields to open tickets and everybody will receive the solution.
It's the same file "/inc/pipe_functions.inc.php" and the same function hesk_email2ticket from my another post. Copy and paste the code between "STARTS HERE" and "ENDS HERE" and replace the other code.
Code: Select all
function hesk_email2ticket($results, $pop3 = 0)
{
global $hesk_settings, $hesklang, $hesk_db_link, $ticket;
// Process "From:" email
$tmpvar['email'] = hesk_validateEmail($results['from'][0]['address'],'ERR',0);
// "From:" email missing or invalid?
if ( ! $tmpvar['email'] )
{
return NULL;
}
### CUSTOMIZATION STARTS HERE ###
// Processa o campo "Cc:"
foreach ($results['cc'] as $c => $cc)
{
// verifica se o campo é válido
$tmpvar['cc'] = hesk_validateEmail($cc['address'],'ERR',0);
// Se o campo "Cc" foi preenchido (e não é o proprio endereço do Hesk) adiciona no campo de emails
if ( $tmpvar['cc'] && $tmpvar['cc'] != $hesk_settings['support_mail'] )
{
$tmpvar['email'] = $tmpvar['email'] . ',' . $tmpvar['cc'];
}
}
// Processa o campo To:"
foreach ($results['to'] as $t => $tt)
{
// verifica se o campo é válido
$tmpvar['to_email'] = hesk_validateEmail($tt['address'],'ERR',0);
// Se o campo "To" foi preenchido (e não é o proprio endereço do Hesk) adiciona no campo de emails
if ( $tmpvar['to_email'] && $tmpvar['to_email'] != $hesk_settings['support_mail'] )
{
$tmpvar['email'] = $tmpvar['email'] . ',' . $tmpvar['to_email'];
}
}
### CUSTOMIZATION ENDS HERE ###
// Process "From:" name, set to "[Customer]" if not set
$tmpvar['name'] = hesk_input($results['from'][0]['name']) or $tmpvar['name'] = $hesklang['pde'];
// Process email subject, convert to UTF-8 if needed, set to "[Piped email]" if none set
$tmpvar['subject'] = $results['subject'];
if ( ! empty($results['subject_encoding']) && strtoupper($results['subject_encoding']) != 'UTF-8' )
{
$tmpvar['subject'] = iconv($results['subject_encoding'], 'UTF-8', $tmpvar['subject']);
}
$tmpvar['subject'] = hesk_input($tmpvar['subject'],'','',1) or $tmpvar['subject'] = $hesklang['pem'];
Cheers
Re: Email piping not allowing multiple emails or CC
Posted: Fri Apr 19, 2013 2:28 pm
by Klemen
Thanks for sharing!
Re: Email piping not allowing multiple emails or CC
Posted: Thu Apr 25, 2013 11:11 pm
by Lisaweb
Yikes! I used your code and nearly crashed my server! Likely it's because it added the piping email address to the email field - and that created an infinite loop of email confirmations!
Does anyone know how to tweak the above code so it doesn't add the piping email address???
Thanks!
Lisa
Re: Email piping not allowing multiple emails or CC
Posted: Fri Apr 26, 2013 4:43 pm
by Klemen
Haven't used or tested any of the above code, but you will probably need something like
Code: Select all
(EMAIL VARIABLE) != 'your@pipedmail.com'
each place where an email could be added to the $tmpvar['email']
Re: Email piping not allowing multiple emails or CC
Posted: Fri Sep 16, 2022 3:51 pm
by artec
Thx for sharing, I´ve found a solution, same file as descrived above (just replace
xxx@support.com for your own support mail:
Code: Select all
// Processa o campo "Cc:"
foreach ($results['cc'] as $c => $cc)
{
// verifica se o campo é válido
$tmpvar['cc'] = hesk_validateEmail($cc['address'],'ERR',0);
// Se o campo "Cc" foi preenchido (e não é o proprio endereço do Hesk) adiciona no campo de emails
if ( $tmpvar['cc'] != 'xxx@support.com' )
{
$tmpvar['email'] = $tmpvar['email'] . ',' . $tmpvar['cc'];
}
}
// Processa o campo To:"
foreach ($results['to'] as $t => $tt)
{
// verifica se o campo é válido
$tmpvar['to_email'] = hesk_validateEmail($tt['address'],'ERR',0);
// Se o campo "To" foi preenchido (e não é o proprio endereço do Hesk) adiciona no campo de emails
if ( $tmpvar['to_email'] != 'xxx@support.com' )
{
$tmpvar['email'] = $tmpvar['email'] . ',' . $tmpvar['to_email'];
}
}
To avoid the creation of new ticket when some of the CC reply, just delete the following code:
Code: Select all
// Do email addresses match?
if ( strpos( strtolower($ticket['email']), strtolower($tmpvar['email']) ) === false )
{
$tmpvar['trackid'] = '';
}
cheers

Re: Email piping not allowing multiple emails or CC
Posted: Fri Sep 16, 2022 5:02 pm
by Klemen
Cool, thank you!