customize email

Everything related to Hesk - helpdesk software

Moderator: mkoch227

Post Reply
alienati
Posts: 5
Joined: Thu Mar 30, 2006 1:40 pm

customize email

Post by alienati »

Hello,

I want to add in the mail of ticket closed the entire text of the ticket(the answeer, not the link of the solution),

in the new_reply_by_staff.txt

can someone help me :?:

Thanks everybody

Sergio, Italy
fluffyturtle
Posts: 2
Joined: Thu Nov 09, 2006 2:34 am

Post by fluffyturtle »

I would love to see this implemented as well.

Thanks!
alienati
Posts: 5
Joined: Thu Mar 30, 2006 1:40 pm

I find the solution!

Post by alienati »

Hello!
Look in Admin_reply_ticket.php
and copy the entire script:
I add the marrked row...and add %%RISP%% in the new replybystaff.txt
now the scipt send a message in the mail!

Many thank to everybody! :wink:



<?php


define('IN_SCRIPT',1);

/* Get all the required files and functions */
require_once('hesk_settings.inc.php');
require_once('language/'.$hesk_settings['language'].'.inc.php');
require_once('inc/common.inc.php');
hesk_session_start();
hesk_isLoggedIn();

/* Print header */
require_once('inc/header2.inc.php');

$message=hesk_input($_POST['message'],$hesklang['enter_message']);
/* Attach signature to the message? */
if (!empty($_POST['signature']))
{
$message .= "<br><br>$_SESSION[signature]<br>&nbsp;";
}
$message=hesk_makeURL($message);
$message=nl2br($message);
$orig_message=hesk_input($_POST['message'],"$hesklang[int_error]: No orig_message");
$orig_name=hesk_input($_POST['orig_name'],"$hesklang[int_error]: No orig_name");
$orig_email=hesk_input($_POST['orig_email'],"$hesklang[int_error]: No valid orig_email");
$orig_subject=hesk_input($_POST['orig_subject'],"$hesklang[int_error]: No orig_subject");
$replyto=hesk_isNumber($_POST['orig_id'],"$hesklang[int_error]: No or invalid orig_id");
$trackingID=hesk_input($_POST['orig_track'],"$hesklang[int_error]: No orig_track");
$trackingURL=$hesk_settings['hesk_url'].'/ticket.php?track='.$trackingID.'&Refresh='.rand(10000,99999);
$admin_trackingURL=$hesk_settings['hesk_url'].'/admin_ticket.php?track='.$trackingID.'&Refresh='.rand(10000,99999);

/* Add to database */
require_once('inc/database.inc.php');
hesk_dbConnect() or hesk_error("$hesklang[cant_connect_db] $hesklang[contact_webmsater] $hesk_settings[webmaster_mail]!");

/* Add reply */
$sql = "
INSERT INTO `hesk_replies` (
`id`,`replyto`,`name`,`message`,`dt`
)
VALUES (
'','$replyto','$_SESSION[name]','$message',NOW()
)
";

$result = hesk_dbQuery($sql) or hesk_error("$hesklang[cant_sql]: $sql</p><p>$hesklang[mysql_said]:<br>".mysql_error()."</p><p>$hesklang[contact_webmsater] $hesk_settings[webmaster_mail]");

/* Change the status of priority? */
if (!empty($_POST['set_priority']))
{
$priority=hesk_input($_POST['priority'],$hesklang['select_priority']);
$priority_sql = ",`priority`=$priority";
}
else
{
$priority_sql = "";
}

/* Close the ticket? If not make sure it is open */
if (!empty($_POST['close']))
{
$sql = "UPDATE `hesk_tickets` SET `status`=0 $priority_sql WHERE `id`=$replyto LIMIT 1";
$result = hesk_dbQuery($sql) or hesk_error("$hesklang[cant_sql]: $sql</p><p>$hesklang[mysql_said]:<br>".mysql_error()."</p><p>$hesklang[contact_webmsater] $hesk_settings[webmaster_mail]");
}
else
{
$sql = "UPDATE `hesk_tickets` SET `status`=1 $priority_sql WHERE `id`=$replyto LIMIT 1";
$result = hesk_dbQuery($sql) or hesk_error("$hesklang[cant_sql]: $sql</p><p>$hesklang[mysql_said]:<br>".mysql_error()."</p><p>$hesklang[contact_webmsater] $hesk_settings[webmaster_mail]");
}

/*** Send "New reply added" e-mail ***/
/* Get e-mail message */
$fp=fopen('emails/new_reply_by_staff.txt','r');
$message=fread($fp,filesize('emails/new_reply_by_staff.txt'));
fclose($fp);

$message=str_replace('%%RISP%%',$orig_message,$message);
$message=str_replace('%%NAME%%',$orig_name,$message);
$message=str_replace('%%SUBJECT%%',$orig_subject,$message);
$message=str_replace('%%TRACK_ID%%',$trackingID,$message);
$message=str_replace('%%TRACK_URL%%',$trackingURL,$message);
$message=str_replace('%%SITE_TITLE%%',$hesk_settings['site_title'] ,$message);
$message=str_replace('%%SITE_URL%%',$hesk_settings['site_url'] ,$message);

/* Send the e-mail */
$headers="From: $hesk_settings[noreply_mail]\n";
$headers.="Reply-to: $hesk_settings[noreply_mail]\n";
@mail($orig_email,$hesklang['new_reply_staff'],$message,$headers);

/* Print admin navigation */
require_once('inc/show_admin_nav.inc.php');

?>

</td>
</tr>
<tr>
<td>

<p>&nbsp;</p>
<h3 align="center"><?php echo $hesklang['reply_added']; ?></h3>
<p>&nbsp;</p>
<p align="center"><?php
echo $hesklang['reply_submitted'].'. ';
if (!empty($_POST['close']))
{
echo $hesklang['ticket_marked']." <font class=\"open\">$hesklang[close]</font>.";
}
?></p>
<p align="center"><a href="<?php echo $admin_trackingURL; ?>"><?php echo $hesklang['view_ticket']; ?></a> |
<a href="admin_main.php"><?php echo $hesklang['main_page']; ?></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>

<hr width="750">
<p>&nbsp;</p>

<?php
require_once('inc/footer.inc.php');
exit();

?>
headguy
Posts: 2
Joined: Mon Dec 18, 2006 1:19 am

Post by headguy »

I tried the code change alienati and it didn't work.

All I get in my email is %%RISP%%

I am picking thru the code to learn how it works.

What I want is the message added to the email sent to staff.
They will get that as a text message on their cell phone.

Oh I am running 93.1 of this code.
jnicastr
Posts: 15
Joined: Mon Oct 29, 2007 10:43 pm

Post by jnicastr »

This worked for me, Version: 0.94.1
Post Reply