One small mod from my side, as a lot of customer doesnt "see" link in default template, changed a bit hesk_mail function to attach emails, maybe someone will also use it or it will be added in future release

Files needed to change: /inc/email_functions.inc.php
find function hesk_mail and in global variable add $ticket after $hesklang, so it will look that way:
Code: Select all
function hesk_mail($to, $subject, $message, $html_message, $tracking_ID = null)
{
global $hesk_settings, $hesklang, $ticket;
Code: Select all
// Save ticket ID in a custom header
if ($tracking_ID !== null) {
$mailer->addCustomHeader('X-Hesk-Tracking_ID', $tracking_ID);
}
Code: Select all
if ($hesk_settings['attachments']['use'] && isset($ticket['attachments']) && strlen($ticket['attachments'])) {
$att = explode(',', substr($ticket['attachments'], 0, -1));
$hesk_settings['server_path'] = dirname(dirname(__FILE__)).'/'.$hesk_settings['attach_dir'];
// Connect to database
hesk_dbConnect();
foreach ($att as $myatt) {
list($att_id, $real_name) = explode('#', $myatt);
// Get attachment info
$res = hesk_dbQuery("SELECT * FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."attachments` WHERE `att_id`='{$att_id}' LIMIT 1");
if (hesk_dbNumRows($res) != 1)
{
hesk_error($hesklang['id_not_valid'].' (att_id)');
}
$file = hesk_dbFetchAssoc($res);
// Path of the file on the server
$realpath = $hesk_settings['server_path'].'/'.$file['saved_name'];
// We should use the real name of file not the filename
$realname = $real_name;
// Perhaps the file has been deleted?
if ( ! file_exists($realpath))
{
hesk_error($hesklang['attdel']);
}
// Attach file to email
$mailer->addAttachment($realpath, $realname);
}
}

