diff --git a/ajax.php b/ajax.php
index fb0520d5c..0618132f1 100644
--- a/ajax.php
+++ b/ajax.php
@@ -300,15 +300,19 @@
$config_ticket_from_email = sanitizeInput($config_ticket_from_email);
$config_mail_from_name = sanitizeInput($config_mail_from_name);
$config_mail_from_email = sanitizeInput($config_mail_from_email);
+
+ // Get Email Template
+ $config_et_client_securelink = prepareEmailTemplate($config_et_client_securelink);
+ $config_et_client_securelink_subj = prepareEmailTemplateTags($config_et_client_securelink_subj);
// Send user e-mail, if specified
if(!empty($config_smtp_host) && filter_var($item_email, FILTER_VALIDATE_EMAIL)){
- $subject = "Time sensitive - $company_name secure link enclosed";
+ $subject = "$config_et_client_securelink_subj";
if ($item_expires_friendly == "never") {
- $subject = "$company_name secure link enclosed";
+ $subject = "$config_et_client_securelink_subj";
}
- $body = "Hello,
$session_name from $company_name sent you a time sensitive secure link regarding \"$item_name\".
The link will expire in $item_expires_friendly and may only be viewed $item_view_limit times, before the link is destroyed.
Click here to access your secure content
--
$company_name - Support
$config_ticket_from_email
$company_phone";
+ $body = "$config_et_client_securelink";
$data = [
[
diff --git a/cron.php b/cron.php
index 47a46b3b5..c11a0f34c 100644
--- a/cron.php
+++ b/cron.php
@@ -441,6 +441,10 @@
$client_name = sanitizeInput($row['client_name']);
$contact_name = sanitizeInput($row['contact_name']);
$contact_email = sanitizeInput($row['contact_email']);
+
+ // Get Email Template
+ $config_et_client_invoice_paymentreminder = prepareEmailTemplate($row['$config_et_client_invoice_paymentreminder']);
+ $config_et_client_invoice_paymentreminder_subj = prepareEmailTemplateTags($row['config_et_client_invoice_paymentreminder_subj']);
// Late Charges
@@ -463,10 +467,8 @@
mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Invoice Overdue', notification = 'Invoice $invoice_prefix$invoice_number for $client_name in the amount of $invoice_amount is overdue by $day days', notification_action = 'invoice.php?invoice_id=$invoice_id', notification_client_id = $client_id, notification_entity_id = $invoice_id");
- $subject = "Overdue Invoice $invoice_prefix$invoice_number";
- $body = "Hello $contact_name,
Our records indicate that we have not yet received payment for the invoice $invoice_prefix$invoice_number. We kindly request that you submit your payment as soon as possible. If you have any questions or concerns, please do not hesitate to contact us at $company_email or $company_phone.
-
- Kindly review the invoice details mentioned below.
Invoice: $invoice_prefix$invoice_number
Issue Date: $invoice_date
Total: " . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . "
Due Date: $invoice_due
Over Due By: $day Days
To view your invoice, please click here.
--
$company_name - Billing
$config_invoice_from_email
$company_phone";
+ $subject = "$config_et_client_invoice_paymentreminder_subj";
+ $body = "$config_et_client_invoice_paymentreminder";
$mail = addToMailQueue($mysqli, [
[
@@ -583,9 +585,13 @@
$client_name = sanitizeInput($row['client_name']);
$contact_name = sanitizeInput($row['contact_name']);
$contact_email = sanitizeInput($row['contact_email']);
+
+ // Get Email Template
+ $config_et_client_invoice_newrecurring = prepareEmailTemplater($row['config_et_client_invoice_newrecurring']);
+ $config_et_client_invoice_newrecurring_subj = prepareEmailTemplateTags($row['config_et_client_invoice_newrecurring_subj']);
- $subject = "Invoice $invoice_prefix$invoice_number";
- $body = "Hello $contact_name,
An invoice regarding \"$invoice_scope\" has been generated. Please view the details below.
Invoice: $invoice_prefix$invoice_number
Issue Date: $invoice_date
Total: " . numfmt_format_currency($currency_format, $invoice_amount, $recurring_currency_code) . "
Due Date: $invoice_due
To view your invoice, please click here.
--
$company_name - Billing
$config_invoice_from_email
$company_phone";
+ $subject = "$config_et_client_invoice_newrecurring_subj";
+ $body = "$config_et_client_invoice_newrecurring";
$mail = addToMailQueue($mysqli, [
[
diff --git a/cron_ticket_email_parser.php b/cron_ticket_email_parser.php
index 9fff2b810..0eb22b104 100644
--- a/cron_ticket_email_parser.php
+++ b/cron_ticket_email_parser.php
@@ -136,9 +136,15 @@ function addTicket($contact_id, $contact_name, $contact_email, $client_id, $date
}
$data = [];
+
if ($config_ticket_client_general_notifications == 1 && $client_id != 0) {
- $subject_email = "Ticket created - [$config_ticket_prefix$ticket_number] - $subject";
- $body = "##- Please type your reply above this line -##
Hello $contact_name,
Thank you for your email. A ticket regarding \"$subject\" has been automatically created for you.
Ticket: $config_ticket_prefix$ticket_number
Subject: $subject
Status: New
https://$config_base_url/portal/ticket.php?id=$id
--
$company_name - Support
$config_ticket_from_email
$company_phone";
+
+ // Get Email Template
+ $config_et_client_ticket_new = prepareEmailTemplate($config_et_client_ticket_new, true);
+ $config_et_client_ticket_new_subj = prepareEmailTemplateTags($config_et_client_ticket_new_subj);
+
+ $subject_email = "$config_et_client_ticket_new_subj";
+ $body = "$config_et_client_ticket_new";
$data[] = [
'from' => $config_ticket_from_email,
diff --git a/database_updates.php b/database_updates.php
index 257b7c6b8..74e0f79b3 100644
--- a/database_updates.php
+++ b/database_updates.php
@@ -2139,4 +2139,4 @@
} else {
// Up-to-date
-}
+}
\ No newline at end of file
diff --git a/email-templates-sample.sql b/email-templates-sample.sql
new file mode 100644
index 000000000..6d8a19401
--- /dev/null
+++ b/email-templates-sample.sql
@@ -0,0 +1,172 @@
+-- phpMyAdmin SQL Dump
+-- version 5.2.1
+-- https://www.phpmyadmin.net/
+--
+-- Host: 127.0.0.1:3306
+-- Generation Time: Jun 30, 2024 at 04:49 PM
+-- Server version: 8.3.0
+-- PHP Version: 8.2.18
+
+SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
+START TRANSACTION;
+SET time_zone = "+00:00";
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8mb4 */;
+
+--
+-- Database: `itflow`
+--
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `settings`
+--
+
+DROP TABLE IF EXISTS `settings`;
+CREATE TABLE IF NOT EXISTS `settings` (
+ `company_id` int NOT NULL,
+ `config_current_database_version` varchar(10) COLLATE utf8mb4_general_ci NOT NULL,
+ `config_start_page` varchar(200) COLLATE utf8mb4_general_ci DEFAULT 'clients.php',
+ `config_smtp_host` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_smtp_port` int DEFAULT NULL,
+ `config_smtp_encryption` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_smtp_username` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_smtp_password` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_mail_from_email` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_mail_from_name` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_imap_host` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_imap_port` int DEFAULT NULL,
+ `config_imap_encryption` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_imap_username` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_imap_password` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_et_client_ticket_new` text COLLATE utf8mb4_general_ci,
+ `config_et_client_ticket_update` text COLLATE utf8mb4_general_ci,
+ `config_et_client_ticket_autoclose` text COLLATE utf8mb4_general_ci,
+ `config_et_client_ticket_updatedpendingclosure` text COLLATE utf8mb4_general_ci,
+ `config_et_client_ticket_closed` text COLLATE utf8mb4_general_ci,
+ `config_default_transfer_from_account` int DEFAULT NULL,
+ `config_default_transfer_to_account` int DEFAULT NULL,
+ `config_default_payment_account` int DEFAULT NULL,
+ `config_default_expense_account` int DEFAULT NULL,
+ `config_default_payment_method` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_default_expense_payment_method` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_default_calendar` int DEFAULT NULL,
+ `config_default_net_terms` int DEFAULT NULL,
+ `config_default_hourly_rate` decimal(15,2) NOT NULL DEFAULT '0.00',
+ `config_project_prefix` varchar(200) COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'PRJ-',
+ `config_project_next_number` int NOT NULL DEFAULT '1',
+ `config_invoice_prefix` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_invoice_next_number` int DEFAULT NULL,
+ `config_invoice_footer` text COLLATE utf8mb4_general_ci,
+ `config_invoice_from_name` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_invoice_from_email` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_invoice_late_fee_enable` tinyint(1) NOT NULL DEFAULT '0',
+ `config_invoice_late_fee_percent` decimal(5,2) NOT NULL DEFAULT '0.00',
+ `config_recurring_prefix` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_recurring_next_number` int NOT NULL,
+ `config_quote_prefix` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_quote_next_number` int DEFAULT NULL,
+ `config_quote_footer` text COLLATE utf8mb4_general_ci,
+ `config_quote_from_name` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_quote_from_email` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_ticket_prefix` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_ticket_next_number` int DEFAULT NULL,
+ `config_ticket_from_name` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_ticket_from_email` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_ticket_email_parse` tinyint(1) NOT NULL DEFAULT '0',
+ `config_ticket_client_general_notifications` tinyint(1) NOT NULL DEFAULT '1',
+ `config_ticket_autoclose` tinyint(1) NOT NULL DEFAULT '0',
+ `config_ticket_autoclose_hours` int NOT NULL DEFAULT '72',
+ `config_ticket_new_ticket_notification_email` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_ticket_default_billable` tinyint(1) NOT NULL DEFAULT '0',
+ `config_enable_cron` tinyint(1) NOT NULL DEFAULT '0',
+ `config_cron_key` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_recurring_auto_send_invoice` tinyint(1) NOT NULL DEFAULT '1',
+ `config_enable_alert_domain_expire` tinyint(1) NOT NULL DEFAULT '1',
+ `config_send_invoice_reminders` tinyint(1) NOT NULL DEFAULT '1',
+ `config_invoice_overdue_reminders` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_stripe_enable` tinyint(1) NOT NULL DEFAULT '0',
+ `config_stripe_publishable` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_stripe_secret` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_stripe_account` int NOT NULL DEFAULT '0',
+ `config_stripe_expense_vendor` int NOT NULL DEFAULT '0',
+ `config_stripe_expense_category` int NOT NULL DEFAULT '0',
+ `config_stripe_percentage_fee` decimal(4,4) NOT NULL DEFAULT '0.0290',
+ `config_ai_enable` tinyint(1) DEFAULT '0',
+ `config_ai_provider` varchar(250) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_ai_model` varchar(250) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_ai_url` varchar(250) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_ai_api_key` varchar(250) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_stripe_flat_fee` decimal(15,2) NOT NULL DEFAULT '0.30',
+ `config_stripe_client_pays_fees` tinyint(1) NOT NULL DEFAULT '0',
+ `config_azure_client_id` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_azure_client_secret` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_module_enable_itdoc` tinyint(1) NOT NULL DEFAULT '1',
+ `config_module_enable_accounting` tinyint(1) NOT NULL DEFAULT '1',
+ `config_client_portal_enable` tinyint(1) NOT NULL DEFAULT '1',
+ `config_login_message` text COLLATE utf8mb4_general_ci,
+ `config_login_key_required` tinyint(1) NOT NULL DEFAULT '0',
+ `config_login_key_secret` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `config_login_remember_me_expire` int NOT NULL DEFAULT '3',
+ `config_module_enable_ticketing` tinyint(1) NOT NULL DEFAULT '1',
+ `config_theme` varchar(200) COLLATE utf8mb4_general_ci DEFAULT 'blue',
+ `config_telemetry` tinyint(1) DEFAULT '0',
+ `config_timezone` varchar(200) COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'America/New_York',
+ `config_destructive_deletes_enable` tinyint(1) NOT NULL DEFAULT '0',
+ `config_phone_mask` tinyint(1) NOT NULL DEFAULT '1',
+ `config_et_client_app_newaccount` text COLLATE utf8mb4_general_ci,
+ `config_et_client_app_passwordreset` text COLLATE utf8mb4_general_ci,
+ `config_et_client_app_passwordresetcomplete` text COLLATE utf8mb4_general_ci,
+ `config_et_client_calendar_rescheduled` text COLLATE utf8mb4_general_ci,
+ `config_et_client_calendar_scheduled` text COLLATE utf8mb4_general_ci,
+ `config_et_client_invoice_new` text COLLATE utf8mb4_general_ci,
+ `config_et_client_invoice_newrecurring` text COLLATE utf8mb4_general_ci,
+ `config_et_client_invoice_paymentfull` text COLLATE utf8mb4_general_ci,
+ `config_et_client_invoice_paymentmultiple` text COLLATE utf8mb4_general_ci,
+ `config_et_client_invoice_paymentpartial` text COLLATE utf8mb4_general_ci,
+ `config_et_client_invoice_paymentreminder` text COLLATE utf8mb4_general_ci,
+ `config_et_client_invoice_paymentstripe` text COLLATE utf8mb4_general_ci,
+ `config_et_client_quote_new` text COLLATE utf8mb4_general_ci,
+ `config_et_client_securelink` text COLLATE utf8mb4_general_ci,
+ `config_et_watcher_notify` text COLLATE utf8mb4_general_ci,
+ `config_et_client_invoice_paid` text COLLATE utf8mb4_general_ci,
+ `config_et_client_ticket_new_subj` text COLLATE utf8mb4_general_ci,
+ `config_et_client_ticket_update_subj` text COLLATE utf8mb4_general_ci,
+ `config_et_client_ticket_autoclose_subj` text COLLATE utf8mb4_general_ci,
+ `config_et_client_ticket_updatedpendingclosure_subj` text COLLATE utf8mb4_general_ci,
+ `config_et_client_ticket_closed_subj` text COLLATE utf8mb4_general_ci,
+ `config_et_client_app_newaccount_subj` text COLLATE utf8mb4_general_ci,
+ `config_et_client_app_passwordreset_subj` text COLLATE utf8mb4_general_ci,
+ `config_et_client_app_passwordresetcomplete_subj` text COLLATE utf8mb4_general_ci,
+ `config_et_client_calendar_rescheduled_subj` text COLLATE utf8mb4_general_ci,
+ `config_et_client_calendar_scheduled_subj` text COLLATE utf8mb4_general_ci,
+ `config_et_client_invoice_new_subj` text COLLATE utf8mb4_general_ci,
+ `config_et_client_invoice_newrecurring_subj` text COLLATE utf8mb4_general_ci,
+ `config_et_client_invoice_paid_subj` text COLLATE utf8mb4_general_ci,
+ `config_et_client_invoice_paymentfull_subj` text COLLATE utf8mb4_general_ci,
+ `config_et_client_invoice_paymentmultiple_subj` text COLLATE utf8mb4_general_ci,
+ `config_et_client_invoice_paymentpartial_subj` text COLLATE utf8mb4_general_ci,
+ `config_et_client_invoice_paymentreminder_subj` text COLLATE utf8mb4_general_ci,
+ `config_et_client_invoice_paymentstripe_subj` text COLLATE utf8mb4_general_ci,
+ `config_et_client_quote_new_subj` text COLLATE utf8mb4_general_ci,
+ `config_et_client_securelink_subj` text COLLATE utf8mb4_general_ci,
+ `config_et_watcher_notify_subj` text COLLATE utf8mb4_general_ci,
+ PRIMARY KEY (`company_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
+
+--
+-- Dumping data for table `settings`
+--
+
+INSERT INTO `settings` (`config_et_client_ticket_new`, `config_et_client_ticket_update`, `config_et_client_ticket_autoclose`, `config_et_client_ticket_updatedpendingclosure`, `config_et_client_ticket_closed`, `config_et_client_app_newaccount`, `config_et_client_app_passwordreset`, `config_et_client_app_passwordresetcomplete`, `config_et_client_calendar_rescheduled`, `config_et_client_calendar_scheduled`, `config_et_client_invoice_new`, `config_et_client_invoice_newrecurring`, `config_et_client_invoice_paymentfull`, `config_et_client_invoice_paymentmultiple`, `config_et_client_invoice_paymentpartial`, `config_et_client_invoice_paymentreminder`, `config_et_client_invoice_paymentstripe`, `config_et_client_quote_new`, `config_et_client_securelink`, `config_et_watcher_notify`, `config_et_client_invoice_paid`, `config_et_client_ticket_new_subj`, `config_et_client_ticket_update_subj`, `config_et_client_ticket_autoclose_subj`, `config_et_client_ticket_updatedpendingclosure_subj`, `config_et_client_ticket_closed_subj`, `config_et_client_app_newaccount_subj`, `config_et_client_app_passwordreset_subj`, `config_et_client_app_passwordresetcomplete_subj`, `config_et_client_calendar_rescheduled_subj`, `config_et_client_calendar_scheduled_subj`, `config_et_client_invoice_new_subj`, `config_et_client_invoice_newrecurring_subj`, `config_et_client_invoice_paid_subj`, `config_et_client_invoice_paymentfull_subj`, `config_et_client_invoice_paymentmultiple_subj`, `config_et_client_invoice_paymentpartial_subj`, `config_et_client_invoice_paymentreminder_subj`, `config_et_client_invoice_paymentstripe_subj`, `config_et_client_quote_new_subj`, `config_et_client_securelink_subj`, `config_et_watcher_notify_subj`) VALUES
+('<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>New Ticket Created</strong><br><br><br><strong>Ticket Number:</strong> [ticket_prefix][ticket_number] <br><br><strong>Title:</strong> [ticket_subject] <br><br><strong>Contact:</strong> [contact_name]<br><br><br>If you would like to check the status of your ticket or provide additional information, please respond to this notification.<br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"> </p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Ticket Updated</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><strong>Ticket Number:</strong> [ticket_prefix][ticket_number] <br><br><strong>Title:</strong> [ticket_subject] <br><br><strong>Contact:</strong> [contact_name] <br><br><br><strong>Response:</strong> <br><br>[ticket_reply] <br><br><br>If you would like to check the status of your ticket or provide additional information, please respond to this notification <br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><strong>Ticket Pending Closure</strong><br><br><br><strong>Ticket Number:</strong> [ticket_prefix][ticket_number] <br><br><strong>Title:</strong> [ticket_subject] <br><br><strong>Contact:</strong> [contact_name] <br><br><br><strong>Message:</strong> <br><br>This is an automatic reminder that your ticket will be closed unless you respond. <br>If your issue has been resolved, you can ignore this email and your ticket will close automatically. <br>If you need further assistance with this ticket, please respond to this email. <br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Ticket Updated</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Ticket Pending Closure</strong> <br><br><br><strong>Ticket Number:</strong> [ticket_prefix][ticket_number] <br><br><strong>Title:</strong> [ticket_subject] <br><br><strong>Contact:</strong> [contact_name] <br><br><br><strong>Response:</strong> <br><br>[ticket_reply] <br><br><br>If your issue has been resolved, you can ignore this email and your ticket will close automatically. <br>If you need further assistance with this ticket, please respond to this email. <br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Ticket Closed</strong> <br><br><br><strong>Ticket Number:</strong> [ticket_prefix][ticket_number] <br><br><strong>Title:</strong> [ticket_subject] <br><br><strong>Contact:</strong> [contact_name] <br><br></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>Your ticket has been closed. We hope to have fixed your issue.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"> <br><strong>Replies to this email will not be received</strong> <br>If you need further assistance, please open a new ticket.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>[company_name] Support Portal</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Account Created</strong><br><br><br><strong>Username:</strong> [username]<br><br><strong>Temporary Password:</strong> [password_info] <br><br></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Portal Link :</strong> <a href="https://[config_base_url]/portal/">https://[config_base_url]/portal/</a><br><br><br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>[company_name] Support Portal</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Password Reset Request</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"> </p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Please <a href="[url]">click here</a> to reset your password.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">If you did not request a password reset, ignore this email.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>[company_name] Support Portal</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Password Reset Notification</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"> </p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Your password for our Support Portal has been reset successfully.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">If you did not request a password reset, please get in touch with us immediately.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><br><br>Thank You, <br>[company_name]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">[company_phone]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Appointment Rescheduled</strong><br><br><br><strong>Title:</strong> [title]<br><br><strong>Appointment Date:</strong> [start] <br><br><strong>Contact:</strong> [contact_name] <br><br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Appointment Scheduled</strong><br><br><br><strong>Title:</strong> [title]<br><br><strong>Appointment Date:</strong> [start] <br><br><strong>Contact:</strong> [contact_name] <br><br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice from [company_name]</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Invoice Title: </strong>[invoice_scope]<br><br><strong>Invoice Date:</strong> [invoice_date] </p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Due Date: </strong>[invoice_due]<br><br><strong>Total Amount:</strong> $[invoice_amount]<br><br></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view your invoice, please <a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[invoice_id]&url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"> </p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice from [company_name]</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Invoice Title: </strong>[invoice_scope]<br><br><strong>Invoice Date:</strong> [invoice_date] </p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Due Date: </strong>[invoice_due]<br><br><strong>Total Amount:</strong> $[invoice_amount]<br><br></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view your invoice, please <a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[new_invoice_id]&url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice Payment Received</strong><br><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Invoice Date:</strong> [invoice_date]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Payment Amount:</strong> $[total_payments_amount]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Balance Due:</strong> $[invoice_balance]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"> </p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view your invoice, please <a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[invoice_id]&url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"> </p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice Payments Received</strong><br><br><br><strong>Payment Details:</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">[email_body_invoices]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"> </p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"> </p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"> </p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice Partial Payment Received</strong><br><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Invoice Date:</strong> [invoice_date]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Payment Amount:</strong> $[amount]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Balance Due:</strong> $[invoice_balance]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"> </p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view your invoice, please <a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[invoice_id]&url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"> </p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Unpaid Invoice Reminder</strong><br><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number] <br><br><strong>Invoice Date:</strong> [invoice_date] </p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Due Date: </strong>[invoice_due]<br><br><strong>Total Amount:</strong> $[invoice_amount]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Our records indicate that we have not yet received payment for this invoice. We kindly request that you submit your payment as soon as possible.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">To view your invoice, please <a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[invoice_id]&url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice Payment Received</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Invoice Date:</strong> [invoice_date]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Payment Amount:</strong> [pi_currency][pi_amount_paid]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"> </p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view your invoice, please <a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[invoice_id]&url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"> </p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>New Quote from [company_name]</strong><br><br><br><strong>Title:</strong> [quote_scope] <br><br><strong>Total Amount:</strong> $[quote_amount]<br><br></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view and accept your quote, please <a href="https://[config_base_url]/guest_view_quote.php?quote_id=[quote_id]&url_key=[quote_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Please contact us with any questions or concerns.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>[session_name] from [company name] has shared a secure link with you</strong><br><br><br><strong>Expires In:</strong> [item_expires_friendly]<br><br><strong>View Count Limit:</strong> [item_view_limit] <br><br></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Link :</strong> <a href="[url]">Click Here</a> </p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>After the expiration time the above link will no longer work. You may want to record the linked content elsewhere, such as a password manager. </p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Ticket Watcher Notification</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><strong>Ticket Number:</strong> [ticket_prefix][ticket_number] <br><br><strong>Title:</strong> [ticket_subject]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"> </p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">You are now a Watcher on this ticket.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"> </p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Ticket Details:</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">[ticket_details]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice Paid</strong><br><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Invoice Date:</strong> [invoice_date]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Payment Amount:</strong> $[amount_paid]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Balance Due:</strong> $[balance]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"> </p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view your invoice, please <a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[new_invoice_id]&url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"> </p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '[[ticket_prefix][ticket_number]] - [ticket_subject] - Ticket Created', '[[ticket_prefix][ticket_number]] - [ticket_subject] - Ticket Updated', '[[ticket_prefix][ticket_number]] - [ticket_subject] - Ticket Pending Closure', '[[ticket_prefix][ticket_number]] - [ticket_subject] - Ticket Pending Closure', '[[ticket_prefix][ticket_number]] - [ticket_subject] - Ticket Closed', '[company_name] Support Portal - New Account Created', '[company_name] Support Portal - Password Reset Request', '[company_name] Support Portal - Password Reset Successfully', '[company_name] - Appointment Rescheduled', '[company_name] - Appointment Scheduled', '[[invoice_prefix][invoice_number]] - [company_name] - Invoice', '[[invoice_prefix][invoice_number]] - [company_name] - Invoice', '[[invoice_prefix][invoice_number]] - [company_name] - Invoice Payment Received', '[[invoice_prefix][invoice_number]] - [company_name] - Invoice Payment Received', '[[invoice_prefix][invoice_number]] - [company_name] - Invoice Payment Received', '[[invoice_prefix][invoice_number]] - [company_name] - Partial Invoice Payment Received', '[[invoice_prefix][invoice_number]] - [company_name] - Invoice Reminder', '[[invoice_prefix][invoice_number]] - [company_name] - Invoice Payment Received', '[[quote_prefix][quote_number]] - [company_name] Quote - [quote_scope]', 'Secure Link from [company_name]', '[[ticket_prefix][ticket_number]] - Ticket Watcher Notification');
+COMMIT;
+
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
diff --git a/functions.php b/functions.php
index 3813981c1..898943774 100644
--- a/functions.php
+++ b/functions.php
@@ -762,6 +762,141 @@ function sanitizeForEmail($data)
return $sanitized;
}
+// Email Template [tag] [[tag]] and [[tag][tag2]] Replacements
+function prepareEmailTemplateTags($emailTemplateTags)
+{
+ // Placeholder to avoid collision with actual content
+ $placeholderPrefix = '__DOUBLE_BRACKET__';
+ $placeholders = [];
+ $counter = 0;
+
+ // Define the predetermined list of accepted tags
+ $acceptedTags = [
+ 'company_name',
+ 'config_base_url',
+ 'ticket_client_id',
+ 'contact_email',
+ 'contact_name',
+ 'ticket_assigned_to',
+ 'ticket_category',
+ 'ticket_created_by',
+ 'ticket_details',
+ 'ticket_number',
+ 'ticket_prefix',
+ 'ticket_priority',
+ 'ticket_subject',
+ 'ticket_id',
+ 'client_id',
+ 'client_name',
+ 'invoice_amount',
+ 'invoice_date',
+ 'invoice_number',
+ 'invoice_prefix',
+ 'invoice_url_key',
+ 'quote_amount',
+ 'quote_date',
+ 'quote_expire',
+ 'quote_number',
+ 'quote_prefix',
+ 'quote_scope',
+ 'quote_url_key',
+ 'client_id',
+ 'contact_email',
+ 'contact_name',
+ 'item_email',
+ 'item_expires_friendly',
+ 'item_type',
+ 'item_view_limit',
+ 'url',
+ 'name',
+ 'password_info',
+ 'username',
+ 'start',
+ 'title',
+ 'ticket_reply',
+ 'company_phone',
+ 'total_payments_amount',
+ 'invoice_balance',
+ 'invoice_scope',
+ 'invoice_due',
+ 'amount_paid',
+ 'balance',
+ 'email_body_invoices',
+ 'pi_currency',
+ 'pi_amount_paid',
+ 'invoice_id',
+ 'new_invoice_id',
+ 'quote_id',
+ 'amount',
+ 'ticket_status'
+
+
+ ];
+
+ // Perform variable substitution for double-bracketed tags [[this]] or [[this][that]]
+ $emailTemplateTags = preg_replace_callback('/\[\[(.*?)\]\]/', function($matches) use (&$placeholders, &$counter, $placeholderPrefix, $acceptedTags) {
+ $innerContent = $matches[1];
+ $parts = explode('][', $innerContent);
+
+ $result = array_map(function($part) use ($acceptedTags) {
+ $part = trim($part);
+ if (in_array($part, $acceptedTags)) {
+ global $$part;
+ return isset($$part) ? $$part : '$' . $part;
+ }
+ return $part; // Keep the part unchanged if it's not in the accepted list
+ }, $parts);
+
+ $placeholder = $placeholderPrefix . $counter++;
+ $placeholders[$placeholder] = '[' . implode('', $result) . ']';
+ return $placeholder;
+ }, $emailTemplateTags);
+
+ // Perform variable substitution for single-bracketed tags [this]
+ $emailTemplateTags = preg_replace_callback('/\[(.*?)\]/', function($matches) use ($acceptedTags) {
+ // Ensure the match is not double-bracketed
+ if (strpos($matches[0], '[[') === false && strpos($matches[0], ']]') === false) {
+ $var_name = $matches[1];
+ if (in_array($var_name, $acceptedTags)) {
+ global $$var_name;
+ return isset($$var_name) ? $$var_name : $matches[0];
+ }
+ }
+ return $matches[0]; // Return the match unchanged if it is double-bracketed or not in the accepted list
+ }, $emailTemplateTags);
+
+ // Replace placeholders with actual double-bracketed replacements
+ foreach ($placeholders as $placeholder => $replacement) {
+ $emailTemplateTags = str_replace($placeholder, $replacement, $emailTemplateTags);
+ }
+
+ // Replace single quotes with escaped quotes
+ $emailTemplateTags = str_replace("'", "\'", $emailTemplateTags);
+
+ return $emailTemplateTags;
+}
+
+
+
+// Prepare Email Template
+function prepareEmailTemplate($emailtemplate, $ticketreply = false)
+{
+ // Check if $ticketreply is true, then prepend the line
+ if ($ticketreply) {
+ $prependText = "##- Please type your reply above this line -##\n
";
+ $emailtemplate = $prependText . $emailtemplate;
+ }
+
+ // Decode HTML entities
+ $emailtemplate = htmlspecialchars_decode($emailtemplate);
+
+ // Email Template [tag] replacement
+ $emailtemplate = prepareEmailTemplateTags($emailtemplate);
+
+ return $emailtemplate;
+}
+
+
function timeAgo($datetime)
{
if (is_null($datetime)) {
diff --git a/get_settings.php b/get_settings.php
index 5aa4e3209..1c2f0ce44 100644
--- a/get_settings.php
+++ b/get_settings.php
@@ -26,6 +26,37 @@
$config_imap_username = $row['config_imap_username'];
$config_imap_password = $row['config_imap_password'];
+// Mail - Email Templates
+$email_template_keys = [
+ 'config_et_client_ticket_new', 'config_et_client_ticket_update', 'config_et_client_ticket_autoclose',
+ 'config_et_client_ticket_updatedpendingclosure', 'config_et_client_ticket_closed', 'config_et_client_app_newaccount',
+ 'config_et_client_app_passwordreset', 'config_et_client_app_passwordresetcomplete', 'config_et_client_calendar_rescheduled',
+ 'config_et_client_calendar_scheduled', 'config_et_client_invoice_new', 'config_et_client_invoice_newrecurring',
+ 'config_et_client_invoice_paid', 'config_et_client_invoice_paymentfull', 'config_et_client_invoice_paymentmultiple',
+ 'config_et_client_invoice_paymentpartial', 'config_et_client_invoice_paymentreminder', 'config_et_client_invoice_paymentstripe',
+ 'config_et_client_quote_new', 'config_et_client_securelink', 'config_et_watcher_notify'
+];
+
+foreach ($email_template_keys as $key) {
+ ${$key} = $row[$key];
+}
+
+// Mail - Email Template Subjects
+$email_subject_keys = [
+ 'config_et_client_ticket_new_subj', 'config_et_client_ticket_update_subj', 'config_et_client_ticket_autoclose_subj',
+ 'config_et_client_ticket_updatedpendingclosure_subj', 'config_et_client_ticket_closed_subj', 'config_et_client_app_newaccount_subj',
+ 'config_et_client_app_passwordreset_subj', 'config_et_client_app_passwordresetcomplete_subj', 'config_et_client_calendar_rescheduled_subj',
+ 'config_et_client_calendar_scheduled_subj', 'config_et_client_invoice_new_subj', 'config_et_client_invoice_newrecurring_subj',
+ 'config_et_client_invoice_paid_subj', 'config_et_client_invoice_paymentfull_subj', 'config_et_client_invoice_paymentmultiple_subj',
+ 'config_et_client_invoice_paymentpartial_subj', 'config_et_client_invoice_paymentreminder_subj', 'config_et_client_invoice_paymentstripe_subj',
+ 'config_et_client_quote_new_subj', 'config_et_client_securelink_subj', 'config_et_watcher_notify_subj'
+];
+
+foreach ($email_subject_keys as $key) {
+ ${$key} = $row[$key];
+}
+
+
// Defaults
$config_start_page = $row['config_start_page'];
$config_default_transfer_from_account = intval($row['config_default_transfer_from_account']);
diff --git a/guest_pay_invoice_stripe.php b/guest_pay_invoice_stripe.php
index 43c2b24a7..8ca4c2f4b 100644
--- a/guest_pay_invoice_stripe.php
+++ b/guest_pay_invoice_stripe.php
@@ -352,10 +352,14 @@ function log_to_console($message) {
$config_invoice_from_email = sanitizeInput($row['config_invoice_from_email']);
$config_base_url = sanitizeInput($config_base_url);
+
+ // Get Email Template
+ $config_et_client_invoice_paymentstripe = prepareEmailTemplate($row['config_et_client_invoice_paymentstripe']);
+ $config_et_client_invoice_paymentstripe_subj = prepareEmailTemplateTags($row['config_et_client_invoice_paymentstripe_subj']);
if (!empty($config_smtp_host)) {
- $subject = "Payment Received - Invoice $invoice_prefix$invoice_number";
- $body = "Hello $contact_name,
We have received your payment in the amount of " . $pi_currency . $pi_amount_paid . " for invoice $invoice_prefix$invoice_number. Please keep this email as a receipt for your records.
Amount: " . numfmt_format_currency($currency_format, $pi_amount_paid, $invoice_currency_code) . "
Balance: " . numfmt_format_currency($currency_format, '0', $invoice_currency_code) . "
Thank you for your business!
~
$company_name - Billing
$config_invoice_from_email
$company_phone";
+ $subject = "$config_et_client_invoice_paymentstripe_subj";
+ $body = "$config_et_client_invoice_paymentstripe";
$data = [
[
diff --git a/portal/login_reset.php b/portal/login_reset.php
index 76e70fd68..0be050f45 100644
--- a/portal/login_reset.php
+++ b/portal/login_reset.php
@@ -78,9 +78,13 @@
mysqli_query($mysqli, "UPDATE contacts SET contact_password_reset_token = '$token' WHERE contact_id = $id LIMIT 1");
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Contact', log_action = 'Modify', log_description = 'Sent a portal password reset e-mail for $email.', log_ip = '$ip', log_user_agent = '$user_agent', log_client_id = $client");
+ // Get Email Template
+ $config_et_client_app_passwordreset = prepareEmailTemplate($config_et_client_app_passwordreset);
+ $config_et_client_app_passwordreset_subj = prepareEmailTemplateTags($config_et_client_app_passwordreset_subj);
+
// Send reset email
- $subject = "Password reset for $company_name Client Portal";
- $body = "Hello $name,
Someone (probably you) has requested a new password for your account on $company_name\'s Client Portal.
Please click here to reset your password.
Alternatively, copy and paste this URL into your browser:
$url
If you didn\'t request this change, you can safely ignore this email.
--
$company_name - Support
$config_ticket_from_email
$company_phone";
+ $subject = "$config_et_client_app_passwordreset_subj";
+ $body = "$config_et_client_app_passwordreset";
$data = [
[
@@ -130,10 +134,14 @@
$password = password_hash($_POST['new_password'], PASSWORD_DEFAULT);
mysqli_query($mysqli, "UPDATE contacts SET contact_password_hash = '$password', contact_password_reset_token = NULL WHERE contact_id = $contact_id LIMIT 1");
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Contact', log_action = 'Modify', log_description = 'Reset portal password for $email.', log_ip = '$ip', log_user_agent = '$user_agent', log_client_id = $client");
-
+
+ // Get Email Template
+ $config_et_client_app_passwordresetcomplete = prepareEmailTemplate($config_et_client_app_passwordresetcomplete);
+ $config_et_client_app_passwordresetcomplete_subj = prepareEmailTemplateTags($config_et_client_app_passwordresetcomplete_subj);
+
// Send confirmation email
- $subject = "Password reset confirmation for $company_name Client Portal";
- $body = "Hello $name,
Your password for your account on $company_name\'s Client Portal was successfully reset. You should be all set!
If you didn\'t reset your password, please get in touch ASAP.
--
$company_name - Support
$config_ticket_from_email
$company_phone";
+ $subject = "$config_et_client_app_passwordresetcomplete_subj";
+ $body = "$config_et_client_app_passwordresetcomplete";
$data = [
diff --git a/post/contact.php b/post/contact.php
index ad885da58..00c1c5809 100644
--- a/post/contact.php
+++ b/post/contact.php
@@ -149,9 +149,13 @@
} else {
$password_info = mysqli_real_escape_string($mysqli, $_POST['contact_password'] . " -- Please change on first login");
}
+
+ // Get Email Template
+ $config_et_client_app_newaccount = prepareEmailTemplate($config_et_client_app_newaccount);
+ $config_et_client_app_newaccount_subj = prepareEmailTemplateTags($config_et_client_app_newaccount_subj);
- $subject = "Your new $company_name portal account";
- $body = "Hello $name,
$company_name has created a support portal account for you.
Username: $email
Password: $password_info
Login URL: https://$config_base_url/portal/
--
$company_name - Support
$config_ticket_from_email
$company_phone";
+ $subject = "$config_et_client_app_newaccount_subj";
+ $body = "$config_et_client_app_newaccount";
// Queue Mail
$data = [
diff --git a/post/event.php b/post/event.php
index 786960b6a..021571eee 100644
--- a/post/event.php
+++ b/post/event.php
@@ -74,14 +74,18 @@
$company_email = sanitizeInput($row['company_email']);
$company_website = sanitizeInput($row['company_website']);
$company_logo = sanitizeInput($row['company_logo']);
+
+ // Get Email Template
+ $config_et_client_calendar_scheduled = prepareEmailTemplate($config_et_client_calendar_scheduled);
+ $config_et_client_calendar_scheduled_subj = prepareEmailTemplateTags($config_et_client_calendar_scheduled_subj);
// Sanitize Config Vars from get_settings.php and Session Vars from check_login.php
$config_mail_from_name = sanitizeInput($config_mail_from_name);
$config_mail_from_email = sanitizeInput($config_mail_from_email);
- $subject = "New Calendar Event";
- $body = "Hello $contact_name,
A calendar event has been scheduled:
Event Title: $title
Event Date: $start
--
$company_name
$company_phone";
-
+ $subject = "$config_et_client_calendar_scheduled_subj";
+ $body = "$config_et_client_calendar_scheduled";
+
$data = [
[
'from' => $config_mail_from_email,
@@ -144,13 +148,17 @@
$company_website = sanitizeInput($row['company_website']);
$company_logo = sanitizeInput($row['company_logo']);
+ // Get Email Template
+ $config_et_client_calendar_rescheduled = prepareEmailTemplate($config_et_client_calendar_rescheduled);
+ $config_et_client_calendar_rescheduled_subj = prepareEmailTemplateTags($config_et_client_calendar_rescheduled_subj);
+
// Sanitize Config Vars from get_settings.php and Session Vars from check_login.php
$config_mail_from_name = sanitizeInput($config_mail_from_name);
$config_mail_from_email = sanitizeInput($config_mail_from_email);
- $subject = "Calendar Event Rescheduled";
- $body = "Hello $contact_name,
A calendar event has been rescheduled:
Event Title: $title
Event Date: $start
--
$company_name
$company_phone";
+ $subject = "$config_et_client_calendar_rescheduled_subj";
+ $body = "$config_et_client_calendar_rescheduled";
$data = [
[
diff --git a/post/invoice.php b/post/invoice.php
index 341906981..058069354 100644
--- a/post/invoice.php
+++ b/post/invoice.php
@@ -636,6 +636,7 @@
$invoice_number = intval($row['invoice_number']);
$invoice_url_key = sanitizeInput($row['invoice_url_key']);
$invoice_currency_code = sanitizeInput($row['invoice_currency_code']);
+ $invoice_date = sanitizeInput($row['invoice_date']);
$client_id = intval($row['client_id']);
$client_name = sanitizeInput($row['client_name']);
$contact_name = sanitizeInput($row['contact_name']);
@@ -673,9 +674,14 @@
$invoice_status = "Paid";
if ($email_receipt == 1) {
+
+ // Get Email Template
+ $config_et_client_invoice_paymentfull = prepareEmailTemplate($config_et_client_invoice_paymentfull);
+ $config_et_client_invoice_paymentfull_subj = prepareEmailTemplateTags($config_et_client_invoice_paymentfull_subj);
- $subject = "Payment Received - Invoice $invoice_prefix$invoice_number";
- $body = "Hello $contact_name,
We have received your payment in full for the amount of " . numfmt_format_currency($currency_format, $amount, $invoice_currency_code) . " for invoice $invoice_prefix$invoice_number. Please keep this email as a receipt for your records.
Amount Paid: " . numfmt_format_currency($currency_format, $amount, $invoice_currency_code) . "
Payment Method: $payment_method
Payment Reference: $reference
Thank you for your business!
--
$company_name - Billing Department
$config_invoice_from_email
$company_phone";
+
+ $subject = "$config_et_client_invoice_paymentfull_subj";
+ $body = "$config_et_client_invoice_paymentfull";
// Queue Mail
$email = [
@@ -706,8 +712,12 @@
if ($email_receipt == 1) {
- $subject = "Partial Payment Received - Invoice $invoice_prefix$invoice_number";
- $body = "Hello $contact_name,
We have received partial payment in the amount of " . numfmt_format_currency($currency_format, $amount, $invoice_currency_code) . " and it has been applied to invoice $invoice_prefix$invoice_number. Please keep this email as a receipt for your records.
Amount Paid: " . numfmt_format_currency($currency_format, $amount, $invoice_currency_code) . "
Payment Method: $payment_method
Payment Reference: $reference
Invoice Balance: " . numfmt_format_currency($currency_format, $invoice_balance, $invoice_currency_code) . "
Thank you for your business!
~
$company_name - Billing
$config_invoice_from_email
$company_phone";
+ // Get Email Template
+ $config_et_client_invoice_paymentpartial = prepareEmailTemplate($config_et_client_invoice_paymentpartial);
+ $config_et_client_invoice_paymentpartial_subj = prepareEmailTemplateTags($config_et_client_invoice_paymentpartial_subj);
+
+ $subject = "$config_et_client_invoice_paymentpartial_subj";
+ $body = "$config_et_client_invoice_paymentpartial";
// Queue Mail
$email = [
@@ -864,9 +874,13 @@
// Sanitize Config vars from get_settings.php
$config_invoice_from_name = sanitizeInput($config_invoice_from_name);
$config_invoice_from_email = sanitizeInput($config_invoice_from_email);
+
+ // Get Email Template
+ $config_et_client_invoice_paymentmultiple = prepareEmailTemplate($config_et_client_invoice_paymentmultiple);
+ $config_et_client_invoice_paymentmultiple_subj = prepareEmailTemplateTags($config_et_client_invoice_paymentmultiple_subj);
- $subject = "Payment Received - Multiple Invoices";
- $body = "Hello $contact_name,
Thank you for your payment of " . numfmt_format_currency($currency_format, $bulk_payment_amount_static, $currency_code) . " We\'ve applied your payment to the following invoices, updating their balances accordingly:
$email_body_invoices
We appreciate your continued business!
Sincerely,
$company_name - Billing
$config_invoice_from_email
$company_phone";
+ $subject = "$config_et_client_invoice_paymentmultiple_subj";
+ $body = "$config_et_client_invoice_paymentmultiple";
// Queue Mail
mysqli_query($mysqli, "INSERT INTO email_queue SET email_recipient = '$contact_email', email_recipient_name = '$contact_name', email_from = '$config_invoice_from_email', email_from_name = '$config_invoice_from_name', email_subject = '$subject', email_content = '$body'");
@@ -989,11 +1003,22 @@
$balance = $invoice_amount - $amount_paid;
if ($invoice_status == 'Paid') {
- $subject = "Invoice $invoice_prefix$invoice_number Receipt";
- $body = "Hello $contact_name,
Please click on the link below to see your invoice regarding \"$invoice_scope\" marked paid.
Invoice Link
--
$company_name - Billing
$config_invoice_from_email
$company_phone";
+
+ // Get Email Template
+ $config_et_client_invoice_paid = prepareEmailTemplate($config_et_client_invoice_paid);
+ $config_et_client_invoice_paid_subj = prepareEmailTemplateTags($config_et_client_invoice_paid_subj);
+
+ $subject = "$config_et_client_invoice_paid_subj";
+ $body = "$config_et_client_invoice_paid";
} else {
- $subject = "Invoice $invoice_prefix$invoice_number";
- $body = "Hello $contact_name,
Please view the details of your invoice regarding \"$invoice_scope\" below.
Invoice: $invoice_prefix$invoice_number
Issue Date: $invoice_date
Total: " . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . "
Balance Due: " . numfmt_format_currency($currency_format, $balance, $invoice_currency_code) . "
Due Date: $invoice_due
To view your invoice, please click here.
--
$company_name - Billing
$config_invoice_from_email
$company_phone";
+
+ // Get Email Template
+ $config_et_client_invoice_new = prepareEmailTemplate($config_et_client_invoice_new);
+ $config_et_client_invoice_new_subj = prepareEmailTemplateTags($config_et_client_invoice_new_subj);
+
+ $subject = "$config_et_client_invoice_new_subj";
+ $body = "$config_et_client_invoice_new";
+
}
// Queue Mail
@@ -1169,11 +1194,15 @@
// Sanitize Config Vars
$config_invoice_from_email = sanitizeInput($config_invoice_from_email);
$config_invoice_from_name = sanitizeInput($config_invoice_from_name);
+
+ // Get Email Template
+ $config_et_client_invoice_newrecurring = prepareEmailTemplate($config_et_client_invoice_newrecurring);
+ $config_et_client_invoice_newrecurring_subj = prepareEmailTemplateTags($config_et_client_invoice_newrecurring_subj);
// Email to client
- $subject = "Invoice $invoice_prefix$invoice_number";
- $body = "Hello $contact_name,
An invoice regarding \"$invoice_scope\" has been generated. Please view the details below.
Invoice: $invoice_prefix$invoice_number
Issue Date: $invoice_date
Total: $$invoice_amount
Due Date: $invoice_due
To view your invoice, please click here.
--
$company_name - Billing
$company_phone";
+ $subject = "$config_et_client_invoice_newrecurring_subj";
+ $body = "$config_et_client_invoice_newrecurring";
$data = [
diff --git a/post/quote.php b/post/quote.php
index 94c055d22..8bc484825 100644
--- a/post/quote.php
+++ b/post/quote.php
@@ -389,9 +389,13 @@
$config_quote_from_name = sanitizeInput($config_quote_from_name);
$config_quote_from_email = sanitizeInput($config_quote_from_email);
$config_base_url = sanitizeInput($config_base_url);
+
+ // Get Email Template
+ $config_et_client_quote_new = prepareEmailTemplate($config_et_client_quote_new);
+ $config_et_client_quote_new_subj = prepareEmailTemplateTags($config_et_client_quote_new_subj);
- $subject = "Quote [$quote_scope]";
- $body = "Hello $contact_name,
Thank you for your inquiry, we are pleased to provide you with the following estimate.
$quote_scope
Total Cost: " . numfmt_format_currency($currency_format, $quote_amount, $quote_currency_code) . "
View and accept your estimate online here
--
$company_name - Sales
$config_quote_from_email
$company_phone";
+ $subject = "$config_et_client_quote_new_subj";
+ $body = "$config_et_client_quote_new";
// Queue Mail
$data = [
diff --git a/post/setting.php b/post/setting.php
index 721a327d2..36c0e6360 100644
--- a/post/setting.php
+++ b/post/setting.php
@@ -235,6 +235,78 @@
}
+// Email templates
+if (isset($_POST['edit_mail_email_template'])) {
+ validateCSRFToken($_POST['csrf_token']);
+ validateAdminRole();
+
+ $fields = [
+ 'config_et_client_ticket_new' => 'sanitizeForEmail',
+ 'config_et_client_ticket_new_subj' => 'sanitizeInput',
+ 'config_et_client_ticket_update' => 'sanitizeForEmail',
+ 'config_et_client_ticket_update_subj' => 'sanitizeInput',
+ 'config_et_client_ticket_autoclose' => 'sanitizeForEmail',
+ 'config_et_client_ticket_autoclose_subj' => 'sanitizeInput',
+ 'config_et_client_ticket_updatedpendingclosure' => 'sanitizeForEmail',
+ 'config_et_client_ticket_updatedpendingclosure_subj' => 'sanitizeInput',
+ 'config_et_client_ticket_closed' => 'sanitizeForEmail',
+ 'config_et_client_ticket_closed_subj' => 'sanitizeInput',
+ 'config_et_client_app_newaccount' => 'sanitizeForEmail',
+ 'config_et_client_app_newaccount_subj' => 'sanitizeInput',
+ 'config_et_client_app_passwordreset' => 'sanitizeForEmail',
+ 'config_et_client_app_passwordreset_subj' => 'sanitizeInput',
+ 'config_et_client_app_passwordresetcomplete' => 'sanitizeForEmail',
+ 'config_et_client_app_passwordresetcomplete_subj' => 'sanitizeInput',
+ 'config_et_client_calendar_rescheduled' => 'sanitizeForEmail',
+ 'config_et_client_calendar_rescheduled_subj' => 'sanitizeInput',
+ 'config_et_client_calendar_scheduled' => 'sanitizeForEmail',
+ 'config_et_client_calendar_scheduled_subj' => 'sanitizeInput',
+ 'config_et_client_invoice_new' => 'sanitizeForEmail',
+ 'config_et_client_invoice_new_subj' => 'sanitizeInput',
+ 'config_et_client_invoice_newrecurring' => 'sanitizeForEmail',
+ 'config_et_client_invoice_newrecurring_subj' => 'sanitizeInput',
+ 'config_et_client_invoice_paid' => 'sanitizeForEmail',
+ 'config_et_client_invoice_paid_subj' => 'sanitizeInput',
+ 'config_et_client_invoice_paymentfull' => 'sanitizeForEmail',
+ 'config_et_client_invoice_paymentfull_subj' => 'sanitizeInput',
+ 'config_et_client_invoice_paymentmultiple' => 'sanitizeForEmail',
+ 'config_et_client_invoice_paymentmultiple_subj' => 'sanitizeInput',
+ 'config_et_client_invoice_paymentpartial' => 'sanitizeForEmail',
+ 'config_et_client_invoice_paymentpartial_subj' => 'sanitizeInput',
+ 'config_et_client_invoice_paymentreminder' => 'sanitizeForEmail',
+ 'config_et_client_invoice_paymentreminder_subj' => 'sanitizeInput',
+ 'config_et_client_invoice_paymentstripe' => 'sanitizeForEmail',
+ 'config_et_client_invoice_paymentstripe_subj' => 'sanitizeInput',
+ 'config_et_client_quote_new' => 'sanitizeForEmail',
+ 'config_et_client_quote_new_subj' => 'sanitizeInput',
+ 'config_et_client_securelink' => 'sanitizeForEmail',
+ 'config_et_client_securelink_subj' => 'sanitizeInput',
+ 'config_et_watcher_notify' => 'sanitizeForEmail',
+ 'config_et_watcher_notify_subj' => 'sanitizeInput',
+ ];
+
+ foreach ($fields as $field => $sanitizeFunction) {
+ ${$field} = $sanitizeFunction($_POST[$field]);
+ }
+
+ $updates = [];
+ foreach ($fields as $field => $_) {
+ $updates[] = "$field = '${$field}'";
+ }
+
+ $updateQuery = "UPDATE settings SET " . implode(', ', $updates) . " WHERE company_id = 1";
+ mysqli_query($mysqli, $updateQuery);
+
+ //Logging
+ mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Settings', log_action = 'Edit', log_description = '$session_name edited email templates', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id");
+
+
+ $_SESSION['alert_message'] = "Email templates edited";
+
+ header("Location: " . $_SERVER["HTTP_REFERER"]);
+}
+
+
if (isset($_POST['edit_invoice_settings'])) {
validateCSRFToken($_POST['csrf_token']);
diff --git a/post/ticket.php b/post/ticket.php
index c1ad77b3a..2ec5437ce 100644
--- a/post/ticket.php
+++ b/post/ticket.php
@@ -136,12 +136,16 @@
$row = mysqli_fetch_array($sql);
$company_name = sanitizeInput($row['company_name']);
$company_phone = sanitizeInput(formatPhoneNumber($row['company_phone']));
+
+ // Get Email Template
+ $config_et_client_ticket_new = prepareEmailTemplate($config_et_client_ticket_new, true);
+ $config_et_client_ticket_new_subj = prepareEmailTemplateTags($config_et_client_ticket_new_subj);
// Verify contact email is valid
if (filter_var($contact_email, FILTER_VALIDATE_EMAIL)) {
- $subject = "Ticket created [$ticket_prefix$ticket_number] - $ticket_subject";
- $body = "##- Please type your reply above this line -##
Hello $contact_name,
A ticket regarding \"$ticket_subject\" has been created for you.
--------------------------------
$ticket_details--------------------------------
Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Status: Open
Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id
--
$company_name - Support
$config_ticket_from_email
$company_phone";
+ $subject = "$config_et_client_ticket_new_subj";
+ $body = "$config_et_client_ticket_new";
// Email Ticket Contact
// Queue Mail
@@ -236,13 +240,16 @@
$row = mysqli_fetch_array($sql);
$company_name = sanitizeInput($row['company_name']);
$company_phone = sanitizeInput(formatPhoneNumber($row['company_phone']));
+
+ // Get Email Template
+ $config_et_client_ticket_new = prepareEmailTemplate($config_et_client_ticket_new, true);
+ $config_et_client_ticket_new_subj = prepareEmailTemplateTags($config_et_client_ticket_new_subj);
// Email content
$data = []; // Queue array
- $subject = "Ticket Created - [$ticket_prefix$ticket_number] - $ticket_subject";
- $body = "##- Please type your reply above this line -##
Hello $contact_name,
A ticket regarding \"$ticket_subject\" has been created for you.
--------------------------------
$ticket_details--------------------------------
Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Status: $ticket_status
Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id
--
$company_name - Support
$config_ticket_from_email
$company_phone";
-
+ $subject = "$config_et_client_ticket_new_subj";
+ $body = "$config_et_client_ticket_new";
// Only add contact to email queue if email is valid
if (filter_var($contact_email, FILTER_VALIDATE_EMAIL)) {
@@ -327,13 +334,16 @@
$row = mysqli_fetch_array($sql);
$company_name = sanitizeInput($row['company_name']);
$company_phone = sanitizeInput(formatPhoneNumber($row['company_phone']));
+
+ // Get Email Template
+ $config_et_client_ticket_new = prepareEmailTemplate($config_et_client_ticket_new, true);
+ $config_et_client_ticket_new_subj = prepareEmailTemplateTags($config_et_client_ticket_new_subj);
// Email content
$data = []; // Queue array
- $subject = "Ticket Created - [$ticket_prefix$ticket_number] - $ticket_subject";
- $body = "##- Please type your reply above this line -##
Hello $contact_name,
A ticket regarding \"$ticket_subject\" has been created for you.
--------------------------------
$ticket_details--------------------------------
Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Status: $ticket_status
Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id
--
$company_name - Support
$config_ticket_from_email
$company_phone";
-
+ $subject = "config_et_client_ticket_new_subj";
+ $body = "$config_et_client_ticket_new";
// Only add contact to email queue if email is valid
if (filter_var($contact_email, FILTER_VALIDATE_EMAIL)) {
@@ -399,12 +409,17 @@
$row = mysqli_fetch_array($sql);
$company_name = sanitizeInput($row['company_name']);
$company_phone = sanitizeInput(formatPhoneNumber($row['company_phone']));
+
+ // Get Email Template
+ $config_et_watcher_notify = prepareEmailTemplate($config_et_watcher_notify);
+ $config_et_watcher_notify_subj = prepareEmailTemplateTags($config_et_watcher_notify_subj);
+
// Email content
$data = []; // Queue array
- $subject = "Ticket Notification - [$ticket_prefix$ticket_number] - $ticket_subject";
- $body = "##- Please type your reply above this line -##
Hello,
You are now a watcher on a ticket regarding \"$ticket_subject\".
--------------------------------
$ticket_details--------------------------------
Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Status: $ticket_status
Guest link: https://$config_base_url/guest_view_ticket.php?ticket_id=$ticket_id&url_key=$url_key
--
$company_name - Support
$config_ticket_from_email
$company_phone";
+ $subject = "$config_et_watcher_notify_subj";
+ $body = "$config_et_watcher_notify";
// Only add watcher to email queue if email is valid
if (filter_var($watcher_email, FILTER_VALIDATE_EMAIL)) {
@@ -929,15 +944,19 @@
$row = mysqli_fetch_array($sql);
$company_name = sanitizeInput($row['company_name']);
$company_phone = sanitizeInput(formatPhoneNumber($row['company_phone']));
+
+ // Get Email Template
+ $config_et_client_ticket_updatedpendingclosure = prepareEmailTemplate($config_et_client_ticket_updatedpendingclosure);
+ $config_et_client_ticket_updatedpendingclosure_subj = prepareEmailTemplateTags($config_et_client_ticket_updatedpendingclosure_subj);
// Check email valid
if (filter_var($contact_email, FILTER_VALIDATE_EMAIL)) {
$data = [];
- $subject = "Ticket resolved - [$ticket_prefix$ticket_number] - $ticket_subject | (pending closure)";
- $body = "##- Please type your reply above this line -##
Hello $contact_name,
Your ticket regarding \"$ticket_subject\" has been marked as solved and is pending closure.
$details
If your request/issue is resolved, you can simply ignore this email. If you need further assistance, please reply or re-open to let us know!
Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Portal: https://$base_url/portal/ticket.php?id=$ticket_id
--
$company_name - Support
$config_ticket_from_email
$company_phone";
-
+ $subject = "$config_et_client_ticket_updatedpendingclosure_subj";
+ $body = "$config_et_client_ticket_updatedpendingclosure";
+
// Email Ticket Contact
// Queue Mail
@@ -1051,14 +1070,18 @@
$row = mysqli_fetch_array($sql);
$company_name = sanitizeInput($row['company_name']);
$company_phone = sanitizeInput(formatPhoneNumber($row['company_phone']));
+
+ // Get Email Template
+ $config_et_client_ticket_update = prepareEmailTemplate($config_et_client_ticket_update, true);
+ $config_et_client_ticket_update_subj = prepareEmailTemplateTags($config_et_client_ticket_update_subj);
// Send e-mail to client if public update & email is set up
if ($private_note == 0 && !empty($config_smtp_host)) {
if (filter_var($contact_email, FILTER_VALIDATE_EMAIL)) {
- $subject = "Ticket update - [$ticket_prefix$ticket_number] - $ticket_subject";
- $body = "##- Please type your reply above this line -##
Hello $contact_name,
Your ticket regarding $ticket_subject has been updated.
--------------------------------
$ticket_reply
--------------------------------
Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Status: $ticket_status_name
Portal: https://$base_url/portal/ticket.php?id=$ticket_id
--
$company_name - Support
$from_email
$company_phone";
+ $subject = "$config_et_client_ticket_update_subj";
+ $body = "$config_et_client_ticket_update";
$data = [];
@@ -1233,7 +1256,8 @@
$row = mysqli_fetch_array($sql);
$company_name = sanitizeInput($row['company_name']);
$company_phone = sanitizeInput(formatPhoneNumber($row['company_phone']));
-
+
+
// Send e-mail to client if public update & email is set up
if ($ticket_reply_type == 'Public' && $send_email == 1 && !empty($config_smtp_host)) {
@@ -1242,12 +1266,23 @@
// Slightly different email subject/text depending on if this update set auto-close
if ($ticket_status == 4) {
- // Resolved
- $subject = "Ticket resolved - [$ticket_prefix$ticket_number] - $ticket_subject | (pending closure)";
- $body = "##- Please type your reply above this line -##
Hello $contact_name,
Your ticket regarding $ticket_subject has been marked as solved and is pending closure.
--------------------------------
$ticket_reply
--------------------------------
If your request/issue is resolved, you can simply ignore this email. If you need further assistance, please reply or re-open to let us know!
Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Status: $ticket_status_name
Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id
--
$company_name - Support
$config_ticket_from_email
$company_phone"; } else {
+
+ // Get Email Template AutoClose
+ $config_et_client_ticket_updatedpendingclosure = prepareEmailTemplate($config_et_client_ticket_updatedpendingclosure, true);
+ $config_et_client_ticket_updatedpendingclosure_subj = prepareEmailTemplateTags($config_et_client_ticket_updatedpendingclosure_subj);
+
+ // Auto-close
+ $subject = "$config_et_client_ticket_updatedpendingclosure_subj";
+ $body = "$config_et_client_ticket_updatedpendingclosure";
+ } else {
+
+ // Get Email Template Update
+ $config_et_client_ticket_update = prepareEmailTemplate($config_et_client_ticket_update, true);
+ $config_et_client_ticket_update_subj = prepareEmailTemplateTags($config_et_client_ticket_update_subj);
+
// Anything else
- $subject = "Ticket update - [$ticket_prefix$ticket_number] - $ticket_subject";
- $body = "##- Please type your reply above this line -##
Hello $contact_name,
Your ticket regarding $ticket_subject has been updated.
--------------------------------
$ticket_reply
--------------------------------
Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Status: $ticket_status_name
Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id
--
$company_name - Support
$config_ticket_from_email
$company_phone";
+ $subject = "$config_et_client_ticket_update_subj";
+ $body = "$config_et_client_ticket_update";
}
$data = [];
@@ -1562,15 +1597,18 @@
$row = mysqli_fetch_array($sql);
$company_name = sanitizeInput($row['company_name']);
$company_phone = sanitizeInput(formatPhoneNumber($row['company_phone']));
+
+ // Get Email Template
+ $config_et_client_ticket_closed = prepareEmailTemplate($config_et_client_ticket_closed);
+ $config_et_client_ticket_closed_subj = prepareEmailTemplateTags($config_et_client_ticket_closed_subj);
// Check email valid
if (filter_var($contact_email, FILTER_VALIDATE_EMAIL)) {
$data = [];
- $subject = "Ticket closed - [$ticket_prefix$ticket_number] - $ticket_subject | (do not reply)";
- //$body = "Hello $contact_name,
Your ticket regarding \"$ticket_subject\" has been closed.
We hope the request/issue was resolved to your satisfaction. If you need further assistance, please raise a new ticket using the below details. Please do not reply to this email.
Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id
--
$company_name - Support
$config_ticket_from_email
$company_phone";
- $body = "Hello $contact_name,
Your ticket regarding \"$ticket_subject\" has been closed.
We hope the request/issue was resolved to your satisfaction, please provide your feedback here.
If you need further assistance, please raise a new ticket using the below details. Please do not reply to this email.
Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id
--
$company_name - Support
$config_ticket_from_email
$company_phone";
+ $subject = "$config_et_client_ticket_closed_subj";
+ $body = "$config_et_client_ticket_closed";
// Email Ticket Contact
// Queue Mail
diff --git a/settings_mail.php b/settings_mail.php
index dde100eec..7bdcd3d43 100644
--- a/settings_mail.php
+++ b/settings_mail.php
@@ -326,6 +326,271 @@
+
+