change check email function in pipe_function.php

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
xep22
Posts: 32
Joined: Fri Jan 28, 2022 10:07 pm

change check email function in pipe_function.php

Post by xep22 »

hello,

I want to make it possible that I can forward emails from my private email-address to the ticket@ address, that the message will be added to the existing ticket through the subject.so I added after line 137 in pipe_function.php this :

Code: Select all

if ( strpos( strtolower($ticket['email']), strtolower($tmpvar['email']) ) === false )
{
	if(strtolower($tmpvar['email']) != 'myprivate1@example.com' && strtolower($tmpvar['email']) != 'myprivate2@example.com')
	{
		$tmpvar['trackid'] = '';
	}
}
but still it will creates a new ticket. but why ? can someone help ?

In my test-file it works fine:

Code: Select all

$ticketEmail = 'frank';
$tmpvar = 'myprivate1';

$trackid = 'xxx';

if ( strpos( strtolower($ticketEmail), strtolower($tmpvar) ) === false )
{
	if(strtolower($tmpvar) != 'myprivate1' && strtolower($tmpvar) != 'myprivate2')
	{
		$trackid = '';
	}
}


if ( empty($trackid) )
{
	// new
	echo 1;
}
else
{
	// answer
	echo 2;
}
I get "2". if I change $tmpvar to "yyy", I get 1.
xep22
Posts: 32
Joined: Fri Jan 28, 2022 10:07 pm

Re: change check email function in pipe_function.php

Post by xep22 »

Oh found it, wrote in my code capital letters in email, so MyPrivate1...

but now the answer is in my name in the ticket (in table hesk_replies in "name" too), but it should be as a answer from the customer.

In pipe_function.php it looks like that it takes the name from the ticket, not the mail ? so it should work ? but it dont.
// Insert reply into database
hesk_dbQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."replies` (`replyto`,`name`,`message`,`message_html`,`dt`,`attachments`) VALUES ('".intval($ticket['id'])."','".hesk_dbEscape($ticket['lastreplier'])."','".hesk_dbEscape($tmpvar['message'])."','".hesk_dbEscape($tmpvar['message'])."',NOW(),'".hesk_dbEscape($tmpvar['attachments'])."')");
Post Reply