From 4e8e072924f2204fce364d225f3b8ceda94cd6c9 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sun, 2 Aug 2015 16:26:53 -0400 Subject: [PATCH] #291 Don't send email if all email fields are empty --- inc/email_functions.inc.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/inc/email_functions.inc.php b/inc/email_functions.inc.php index 1f26106d..fc335c19 100644 --- a/inc/email_functions.inc.php +++ b/inc/email_functions.inc.php @@ -341,8 +341,11 @@ function hesk_mail($to,$subject,$message,$htmlMessage,$cc=array(),$bcc=array(),$ { global $hesk_settings, $hesklang, $modsForHesk_settings, $ticket; - // Demo mode - if ( defined('HESK_DEMO') ) + // Are we in demo mode or are all email fields blank? If so, don't send an email. + if ( defined('HESK_DEMO') + || (($to == NULL || $to == '') + && ($cc == NULL || count($cc) == 0) + && ($bcc == NULL || count($bcc) == 0))) { return true; }