From 6033b093444a8cc67e296124e14b14ef91fbf6e0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Fri, 24 Jun 2016 15:36:20 +0200 Subject: [PATCH] FIX: A constructor must not return a value. FIX: A topic is required to send an email (probability to be spam of 99%) --- htdocs/core/class/CMailFile.class.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 1db31697bb8..563ec168d29 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -134,6 +134,13 @@ class CMailFile dol_syslog("CMailFile::CMailfile: MAIN_MAIL_SENDMODE=".$conf->global->MAIN_MAIL_SENDMODE." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, trackid=$trackid", LOG_DEBUG); dol_syslog("CMailFile::CMailfile: subject=$subject, deliveryreceipt=$deliveryreceipt, msgishtml=$msgishtml", LOG_DEBUG); + if (empty($subject)) + { + dol_syslog("CMailFile::CMailfile: Try to send an email with empty subject"); + $this->error='ErrorSubjectIsRequired'; + return; + } + // Detect if message is HTML (use fast method) if ($msgishtml == -1) { @@ -436,8 +443,7 @@ class CMailFile { // Send mail method not correctly defined // -------------------------------------- - - return 'Bad value for MAIN_MAIL_SENDMODE constant'; + $this->error = 'Bad value for MAIN_MAIL_SENDMODE constant'; } } -- GitLab