Page 1 of 1

Admin Reply Ticket email behaviour.

Posted: Wed Apr 18, 2012 8:26 pm
by steve
Hi,

I want to change the email behavior of the admin reply ticket function.

When a User replies to a ticket I want the email to skip the user and go to all administrators.

When an Administrator replies to a ticket I want the email to skip the administrator(s) and go to the email entered in the ticket.

Can anybody help me with this?

-Steve

Re: Admin Reply Ticket email behaviour.

Posted: Thu Apr 19, 2012 12:01 pm
by Klemen
Like in your previous question you can check for admin using $_SESSION['isadmin'] and in database query get just users with `isadmin`='1' from the database to get list of admins.

The exact code to use here would be up to you as this is out of the scope of my support.

From your questions I presume you wish to use regular staff accounts as user (customer) logins?

Re: Admin Reply Ticket email behaviour.

Posted: Tue Apr 24, 2012 10:52 pm
by steve
Yes, users are being used as customer logins.

Our service department is not that big, so when a ticket is submitted it is sent to a forwarding email address within our domain. (newticket@ourdomain.com forwards to john@ourdomain.com & jane@ourdomain.com)
I got it to work the way I need it to with some help from Klemen, Thanks!

The code I used it this:

admin/admin_reply_ticket.php

Find

Code: Select all

/*** Send "New reply added" e-mail ***/

/* Setup ticket message for e-mail */
$ticket['message'] = hesk_msgToPlain($message,1);

/* Format e-mail message */
$msg = hesk_getEmailMessage('new_reply_by_staff',$ticket);

/* Send e-mail */
hesk_mail($ticket['email'],$hesklang['new_reply_staff'],$msg);
Change to

Code: Select all

/*** Send "New reply added" e-mail ***/

/* Setup ticket message for e-mail */
$ticket['message'] = hesk_msgToPlain($message,1);

/* Format e-mail message */
$msg = hesk_getEmailMessage('new_reply_by_staff',$ticket);
$msg1 = hesk_getEmailMessage('new_reply_by_customer',$ticket);

/* Send e-mail */

		    if ($_SESSION['isadmin'])
    {
	hesk_mail($ticket['email'],$hesklang['new_reply_staff'],$msg);
    }
    else
    {
	hesk_mail('newticket@ourdomain.com',$hesklang['new_reply_staff'],$msg1);
    }
    

If a user submits a reply the email is sent to a specific email address (email@mydomain.com)
If a admin submits a reply the email goes to the user who submitted the ticket.

I hope somebody else finds this useful.