From 75dee7538b76c07c522c88fe407e97c323a18638 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Jun 2018 01:15:37 +0200 Subject: [PATCH] Fix add protection to avoir fatal error 500 --- htdocs/core/class/CMailFile.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index a507233630d..58161aef6f5 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -657,6 +657,12 @@ class CMailFile } else if ($this->sendmode == 'smtps') { + if (! is_object($this->smtps)) + { + $this->error="Failed to send mail with smtps lib to HOST=".$server.", PORT=".$conf->global->$keyforsmtpport."
Constructor of object CMailFile was not initialized without errors."; + dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); + return false; + } // Use SMTPS library // ------------------------------------------