diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 1db31697bb8f9b41b1581701040f77fec7fd43b1..563ec168d297f4beb72c30904d1841a1a1924aaf 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'; } }