From a819dff19a5bf0e87efa66afe1acccd6f7721693 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Wed, 24 Jun 2026 12:47:41 -0400 Subject: [PATCH] Mail: Update mail configuration check to use smtp_provider instead of smtp_host as host is blank upon using oath2 --- agent/invoice.php | 2 +- agent/invoices.php | 2 +- agent/modals/payment/payment_add.php | 2 +- agent/modals/payment/payment_bulk_add.php | 2 +- agent/post/contact.php | 2 +- agent/post/payment.php | 4 ++-- agent/post/recurring_ticket.php | 6 +++--- agent/post/ticket.php | 22 +++++++++++----------- agent/quote.php | 2 +- agent/quotes.php | 2 +- cron/cron.php | 5 +++-- login.php | 7 ++++--- 12 files changed, 30 insertions(+), 28 deletions(-) diff --git a/agent/invoice.php b/agent/invoice.php index 4f11cb63..f96b6411 100644 --- a/agent/invoice.php +++ b/agent/invoice.php @@ -291,7 +291,7 @@ if (isset($_GET['invoice_id'])) { Packing Slip - + Send Email diff --git a/agent/invoices.php b/agent/invoices.php index 17466994..0e46a58a 100644 --- a/agent/invoices.php +++ b/agent/invoices.php @@ -422,7 +422,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); Copy - + Send Email diff --git a/agent/modals/payment/payment_add.php b/agent/modals/payment/payment_add.php index 28a1dfcb..cfb0b61d 100644 --- a/agent/modals/payment/payment_add.php +++ b/agent/modals/payment/payment_add.php @@ -157,7 +157,7 @@ ob_start(); - +
diff --git a/agent/modals/payment/payment_bulk_add.php b/agent/modals/payment/payment_bulk_add.php index a4fe1edb..c3ad9aa3 100644 --- a/agent/modals/payment/payment_bulk_add.php +++ b/agent/modals/payment/payment_bulk_add.php @@ -159,7 +159,7 @@ ob_start();
- +
diff --git a/agent/post/contact.php b/agent/post/contact.php index 010de96b..2da5871e 100644 --- a/agent/post/contact.php +++ b/agent/post/contact.php @@ -172,7 +172,7 @@ if (isset($_POST['edit_contact'])) { } // Send contact a welcome e-mail, if specified - if ($send_email && $auth_method && $config_smtp_host && $contact_user_id) { + if ($send_email && $auth_method && $config_smtp_provider && $contact_user_id) { // Sanitize Config vars from get_settings.php $config_ticket_from_email = sanitizeInput($config_ticket_from_email); diff --git a/agent/post/payment.php b/agent/post/payment.php index c0080569..1d4cd713 100644 --- a/agent/post/payment.php +++ b/agent/post/payment.php @@ -443,7 +443,7 @@ if (isset($_POST['add_payment_stripe'])) { mysqli_query($mysqli, "INSERT INTO history SET history_status = 'Paid', history_description = 'Online Payment added (agent)', history_invoice_id = $invoice_id"); // Email receipt - if (!empty($config_smtp_host)) { + if (!empty($config_smtp_provider)) { $subject = "Payment Received - Invoice $invoice_prefix$invoice_number"; $body = "Hello $contact_name,

We have received online payment for the amount of " . numfmt_format_currency($currency_format, $invoice_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, $invoice_amount, $invoice_currency_code) . "

Thank you for your business!


--
$company_name - Billing Department
$config_invoice_from_email
$company_phone"; @@ -628,7 +628,7 @@ if (isset($_GET['add_payment_stripe'])) { mysqli_query($mysqli, "INSERT INTO history SET history_status = 'Paid', history_description = 'Online Payment added (agent)', history_invoice_id = $invoice_id"); // Email receipt - if (!empty($config_smtp_host)) { + if (!empty($config_smtp_provider)) { $subject = "Payment Received - Invoice $invoice_prefix$invoice_number"; $body = "Hello $contact_name,

We have received online payment for the amount of " . numfmt_format_currency($currency_format, $invoice_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, $invoice_amount, $invoice_currency_code) . "

Thank you for your business!


--
$company_name - Billing Department
$config_invoice_from_email
$company_phone"; diff --git a/agent/post/recurring_ticket.php b/agent/post/recurring_ticket.php index 686163c2..0e2ac68f 100644 --- a/agent/post/recurring_ticket.php +++ b/agent/post/recurring_ticket.php @@ -166,7 +166,7 @@ if (isset($_POST['bulk_force_recurring_tickets'])) { $data = []; // Notify client by email their ticket has been raised, if general notifications are turned on & there is a valid contact email - if (!empty($config_smtp_host) && $config_ticket_client_general_notifications == 1 && filter_var($contact_email, FILTER_VALIDATE_EMAIL)) { + if (!empty($config_smtp_provider) && $config_ticket_client_general_notifications == 1 && filter_var($contact_email, FILTER_VALIDATE_EMAIL)) { $email_subject = "Ticket Created - [$ticket_prefix$ticket_number] - $ticket_subject (scheduled)"; $email_body = "##- Please type your reply above this line -##

Hello $contact_name,

A ticket regarding \"$ticket_subject\" has been automatically created for you.

--------------------------------
$ticket_details--------------------------------

Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Status: Open
Portal: https://$config_base_url/client/ticket.php?id=$id

--
$company_name - Support
$config_ticket_from_email
$company_phone"; @@ -306,7 +306,7 @@ if (isset($_GET['force_recurring_ticket'])) { $data = []; // Notify client by email their ticket has been raised, if general notifications are turned on & there is a valid contact email - if (!empty($config_smtp_host) && $config_ticket_client_general_notifications == 1 && filter_var($contact_email, FILTER_VALIDATE_EMAIL)) { + if (!empty($config_smtp_provider) && $config_ticket_client_general_notifications == 1 && filter_var($contact_email, FILTER_VALIDATE_EMAIL)) { $email_subject = "Ticket created - [$ticket_prefix$ticket_number] - $ticket_subject (scheduled)"; $email_body = "##- Please type your reply above this line -##

Hello $contact_name,

A ticket regarding \"$ticket_subject\" has been automatically created for you.

--------------------------------
$ticket_details--------------------------------

Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Status: Open
Portal: https://$config_base_url/client/ticket.php?id=$id

--
$company_name - Support
$config_ticket_from_email
$company_phone"; @@ -484,7 +484,7 @@ if (isset($_POST['bulk_assign_recurring_ticket'])) { mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Recurring Ticket', notification = '$recurring_ticket_count Recurring Tickets have been assigned to you by $session_name', notification_action = 'recurring_tickets.php?assigned=$assign_to', notification_client_id = $client_id, notification_user_id = $assign_to"); // Agent Email Notification - if (!empty($config_smtp_host)) { + if (!empty($config_smtp_provider)) { // Sanitize Config vars from get_settings.php $config_ticket_from_name = sanitizeInput($config_ticket_from_name); diff --git a/agent/post/ticket.php b/agent/post/ticket.php index a757d2a6..7026e8dd 100644 --- a/agent/post/ticket.php +++ b/agent/post/ticket.php @@ -111,7 +111,7 @@ if (isset($_POST['add_ticket'])) { } // E-mail client - if ((!empty($config_smtp_host) || !empty($config_smtp_provider)) && $config_ticket_client_general_notifications == 1) { + if ((!empty($config_smtp_provider) || !empty($config_smtp_provider)) && $config_ticket_client_general_notifications == 1) { // Get contact/ticket details $sql = mysqli_query($mysqli, "SELECT contact_name, contact_email, ticket_prefix, ticket_number, ticket_category, ticket_subject, ticket_details, ticket_priority, ticket_status, ticket_created_by, ticket_assigned_to, ticket_client_id FROM tickets @@ -273,7 +273,7 @@ if (isset($_POST['edit_ticket'])) { $client_id = intval($row['ticket_client_id']); // Notify new contact if selected - if ($notify && (!empty($config_smtp_host) || !empty($config_smtp_provider))) { + if ($notify && (!empty($config_smtp_provider) || !empty($config_smtp_provider))) { // Get Company Name Phone Number and Sanitize for Email Sending $sql = mysqli_query($mysqli, "SELECT company_name, company_phone, company_phone_country_code FROM companies WHERE company_id = 1"); @@ -406,7 +406,7 @@ if (isset($_POST['edit_ticket_contact'])) { $contact_email = sanitizeInput($row['contact_email']); // Notify new contact (if selected, valid & configured) - if ($notify && filter_var($contact_email, FILTER_VALIDATE_EMAIL) && (!empty($config_smtp_host) || !empty($config_smtp_provider))) { + if ($notify && filter_var($contact_email, FILTER_VALIDATE_EMAIL) && (!empty($config_smtp_provider) || !empty($config_smtp_provider))) { // Get Company Phone Number $sql = mysqli_query($mysqli, "SELECT company_name, company_phone, company_phone_country_code FROM companies WHERE company_id = 1"); @@ -530,7 +530,7 @@ if (isset($_POST['add_ticket_watcher'])) { mysqli_query($mysqli, "INSERT INTO ticket_watchers SET watcher_email = '$watcher_email', watcher_ticket_id = $ticket_id"); // Notify watcher - if ($notify && (!empty($config_smtp_host) || !empty($config_smtp_provider))) { + if ($notify && (!empty($config_smtp_provider))) { @@ -813,7 +813,7 @@ if (isset($_POST['assign_ticket'])) { mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Ticket', notification = 'Ticket $ticket_prefix$ticket_number - Subject: $ticket_subject has been assigned to you by $session_name', notification_action = '/agent/ticket.php?ticket_id=$ticket_id$client_uri', notification_client_id = $client_id, notification_user_id = $assigned_to"); // Email Notification - if (!empty($config_smtp_host) || !empty($config_smtp_provider)) { + if (!empty($config_smtp_provider)) { // Sanitize Config vars from get_settings.php $config_ticket_from_name = sanitizeInput($config_ticket_from_name); @@ -1025,7 +1025,7 @@ if (isset($_POST['bulk_assign_ticket'])) { mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Ticket', notification = '$ticket_count Tickets have been assigned to you by $session_name', notification_action = 'tickets.php?status=Open&assigned=$assign_to', notification_client_id = $client_id, notification_user_id = $assign_to"); // Agent Email Notification - if (!empty($config_smtp_host) || !empty($config_smtp_provider)) { + if (!empty($config_smtp_provider)) { // Sanitize Config vars from get_settings.php $config_ticket_from_name = sanitizeInput($config_ticket_from_name); @@ -1300,7 +1300,7 @@ if (isset($_POST['bulk_resolve_tickets'])) { customAction('ticket_resolve', $ticket_id); // Client notification email - if ((!empty($config_smtp_host) || !empty($config_smtp_provider)) && $config_ticket_client_general_notifications == 1 && $private_note == 0) { + if ((!empty($config_smtp_provider)) && $config_ticket_client_general_notifications == 1 && $private_note == 0) { // Get Contact details $ticket_sql = mysqli_query($mysqli, "SELECT contact_name, contact_email FROM tickets @@ -1486,7 +1486,7 @@ if (isset($_POST['bulk_ticket_reply'])) { $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code'])); // Send e-mail to client if public update & email is set up - if ($private_note == 0 && (!empty($config_smtp_host) || !empty($config_smtp_provider))) { + if ($private_note == 0 && (!empty($config_smtp_provider))) { $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: View ticket

--
$company_name - Support
$from_email
$company_phone"; @@ -1822,7 +1822,7 @@ if (isset($_POST['add_ticket_reply'])) { $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code'])); // Send e-mail to client if public update & email is set up - if ($ticket_reply_type == 'Public' && $send_email == 1 && (!empty($config_smtp_host) || !empty($config_smtp_provider))) { + if ($ticket_reply_type == 'Public' && $send_email == 1 && (!empty($config_smtp_provider))) { // Slightly different email subject/text depending on if this update set auto-close @@ -2131,7 +2131,7 @@ if (isset($_GET['resolve_ticket'])) { customAction('ticket_resolve', $ticket_id); // Client notification email - if ((!empty($config_smtp_host) || !empty($config_smtp_provider)) && $config_ticket_client_general_notifications == 1) { + if ((!empty($config_smtp_provider)) && $config_ticket_client_general_notifications == 1) { // Get details $ticket_sql = mysqli_query($mysqli, "SELECT contact_name, contact_email, ticket_prefix, ticket_number, ticket_subject, ticket_status_name, ticket_assigned_to, ticket_url_key FROM tickets @@ -2233,7 +2233,7 @@ if (isset($_GET['close_ticket'])) { customAction('ticket_close', $ticket_id); // Client notification email - if ((!empty($config_smtp_host) || !empty($config_smtp_provider)) && $config_ticket_client_general_notifications == 1) { + if ((!empty($config_smtp_provider)) && $config_ticket_client_general_notifications == 1) { // Get details $ticket_sql = mysqli_query($mysqli, "SELECT contact_name, contact_email, ticket_prefix, ticket_number, ticket_subject, ticket_url_key FROM tickets diff --git a/agent/quote.php b/agent/quote.php index 737b6bb7..d5f9c9ea 100644 --- a/agent/quote.php +++ b/agent/quote.php @@ -149,7 +149,7 @@ if (isset($_GET['quote_id'])) { Send