From 163cb0b372dc954658dabef944ac39b7c28cb726 Mon Sep 17 00:00:00 2001 From: Alex <40072887+alexdcrane@users.noreply.github.com> Date: Fri, 17 Apr 2026 16:13:49 +0000 Subject: [PATCH] Add checks for email subject and body before sending (#7881) --- core/users/user_edit.php | 10 ++++++---- core/users/user_profile.php | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/core/users/user_edit.php b/core/users/user_edit.php index 6fe22ff85..f92f7790c 100644 --- a/core/users/user_edit.php +++ b/core/users/user_edit.php @@ -592,11 +592,13 @@ } unset($sql, $parameters, $row); - //replace variables in email body - $email_body = str_replace('${domain}', $domain_name, $email_body); + if (!empty($email_subject) && !empty($email_body)) { + //replace variables in email body + $email_body = str_replace('${domain}', $domain_name, $email_body); - //send the email - send_email($user_email, $email_subject, $email_body, $eml_error); + //send the email + send_email($user_email, $email_subject, $email_body, $eml_error); + } //build the user log array $log_array['type'] = 'Password Changed'; diff --git a/core/users/user_profile.php b/core/users/user_profile.php index da8ba9fa6..fcbfc8ac1 100644 --- a/core/users/user_profile.php +++ b/core/users/user_profile.php @@ -456,11 +456,13 @@ } unset($sql, $parameters, $row); - //replace variables in email body - $email_body = str_replace('${domain}', $domain_name, $email_body); + if (!empty($email_subject) && !empty($email_body)) { + //replace variables in email body + $email_body = str_replace('${domain}', $domain_name, $email_body); - //send the email - send_email($user_email, $email_subject, $email_body, $eml_error); + //send the email + send_email($user_email, $email_subject, $email_body, $eml_error); + } //get the username $sql = "select username from v_users ";