Category select by user via email (POP3 Fetching)

Everything related to Hesk - helpdesk software

Moderator: mkoch227

Post Reply
slide
Posts: 1
Joined: Tue Nov 19, 2013 7:14 am

Category select by user via email (POP3 Fetching)

Post by slide »

Hello! I really like HESK, it is a very good product that really helped me.

The only thing I need is the automatic assignment of categories from mail using pop3 fetching. That is, we give the client, for example, the pattern in which the:
1 - general category, 2 - problems, etc.
User wrote in a letter category id, for example at the beginning of the letter:
"category = 1"
And the ticket created in category equal to the id, which is indicated by the user.

Something like this ) it is even possible to do?
holographic
Posts: 1
Joined: Sat Jan 04, 2014 10:17 pm

Re: Category select by user via email (POP3 Fetching)

Post by holographic »

I would like to do something like this as well..

I want to use a custom (HTML) form to send an email to hesk. Can I use a hidden field to specify the category?

I have tried several ways but none seem to work. Any ideas?
Klemen
Site Admin
Posts: 10135
Joined: Fri Feb 11, 2005 4:04 pm

Re: Category select by user via email (POP3 Fetching)

Post by Klemen »

There is no built-in way of doing it.

The quickest way to get this working would be to add something like this to the email message somewhere (at start, end, ... doesn't matter):

Code: Select all

{CATEGORY=1}
Then you could change this code in "inc/pipe_functions.inc.php"

Code: Select all

$tmpvar['category'] 	= 1;
to

Code: Select all

$tmpvar['category'] = ( preg_match('/\{CATEGORY=([0-9]{1,})\}/', $tmpvar['message'], $m) ) ? $m[1] : 1;
So, if you wanted to select category with ID 15 you would include this in the email message:

{CATEGORY=15}
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
dr_patso
Posts: 192
Joined: Tue May 15, 2012 3:23 am

Re: Category select by user via email (POP3 Fetching)

Post by dr_patso »

Beautiful.
alfredm
Posts: 2
Joined: Sun Mar 09, 2014 6:01 am

Re: Category select by user via email (POP3 Fetching)

Post by alfredm »

Any way to get this mod to work with the pop3 functionality?
Klemen
Site Admin
Posts: 10135
Joined: Fri Feb 11, 2005 4:04 pm

Re: Category select by user via email (POP3 Fetching)

Post by Klemen »

It's the same file/code.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
dr_patso
Posts: 192
Joined: Tue May 15, 2012 3:23 am

Re: Category select by user via email (POP3 Fetching)

Post by dr_patso »

what kind of logic can be added for a user to make this change in a reply? adding this code only works for brand new tickets.
dr_patso
Posts: 192
Joined: Tue May 15, 2012 3:23 am

Re: Category select by user via email (POP3 Fetching)

Post by dr_patso »

okay, this works. Maybe not the best way but from my testing it appears to work.


in /inc/pipe_functions.inc.php below this line

Code: Select all

	if ($is_reply)
	{

Add

Code: Select all

		// Set category
		if ( preg_match('/\{CATEGORY=([0-9]{1,})\}/', $tmpvar['message'], $matches) )
		{
			$tmpvar['category'] = ( preg_match('/\{CATEGORY=([0-9]{1,})\}/', $tmpvar['message'], $m) ) ? $m[1] : 1;
			hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` SET `category`='{$tmpvar['category']}' WHERE `id`='".intval($ticket['id'])."' LIMIT 1");
		}
This will give you the ability to update category in a reply.. It will not modify category if there is no match for {CATEGORY=ID} in the message
Post Reply