From 9bd28b1c568877aa6a9b2b37448776668cb4d8ff Mon Sep 17 00:00:00 2001 From: johnnyq Date: Tue, 16 Jan 2024 22:56:35 -0500 Subject: [PATCH] Update Mail Send Test to use the proper from name when sending a test also show the from name from the select --- post/setting.php | 19 +++++++++++++++++-- settings_mail.php | 20 +++++++++++--------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/post/setting.php b/post/setting.php index de9b0f9a..750d5414 100644 --- a/post/setting.php +++ b/post/setting.php @@ -151,7 +151,22 @@ if (isset($_POST['test_email_smtp'])) { validateCSRFToken($_POST['csrf_token']); validateAdminRole(); - $email_from = sanitizeInput($_POST['email_from']); + + $test_email = intval($_POST['test_email']); + if($test_email == 1) { + $email_from = sanitizeInput($config_mail_from_email); + $email_from_name = sanitizeInput($config_mail_from_name); + } elseif ($test_email == 2) { + $email_from = sanitizeInput($config_invoice_from_email); + $email_from_name = sanitizeInput($config_invoice_from_name); + } elseif ($test_email == 3) { + $email_from = sanitizeInput($config_quote_from_email); + $email_from_name = sanitizeInput($config_quote_from_name); + } else { + $email_from = sanitizeInput($config_ticket_from_email); + $email_from_name = sanitizeInput($config_ticket_from_name); + } + $email_to = sanitizeInput($_POST['email_to']); $subject = "Test email from ITFlow"; $body = "This is a test email from ITFlow. If you are reading this, it worked!"; @@ -159,7 +174,7 @@ if (isset($_POST['test_email_smtp'])) { $data = [ [ 'from' => $email_from, - 'from_name' => $email_from, + 'from_name' => $email_from_name, 'recipient' => $email_to, 'recipient_name' => 'Chap', 'subject' => $subject, diff --git a/settings_mail.php b/settings_mail.php index 6a55793b..bee8af34 100644 --- a/settings_mail.php +++ b/settings_mail.php @@ -269,31 +269,33 @@ require_once "inc_all_settings.php";
- - + - + - + - + + +