Skip to content

Commit

Permalink
fix: better error reporting in CMailFile
Browse files Browse the repository at this point in the history
  • Loading branch information
FHenry committed Sep 20, 2024
1 parent 65e5899 commit cddbf3a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions htdocs/core/class/CMailFile.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ public function sendfile()
}
} elseif ($this->sendmode == 'smtps') {
if (!is_object($this->smtps)) {
$this->error = "Failed to send mail with smtps lib to HOST=".$server.", PORT=".$conf->global->$keyforsmtpport."<br>Constructor of object CMailFile was not initialized without errors.";
$this->error = "Failed to send mail with smtps lib to HOST=".ini_get('SMTP').", PORT=".$conf->global->$keyforsmtpport."<br>Constructor of object CMailFile was not initialized without errors.";
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
return false;
}
Expand Down Expand Up @@ -1165,9 +1165,10 @@ public function sendfile()
$res = true;
if (!empty($this->error) || !empty($this->errors) || !$result) {
if (!empty($failedRecipients)) {
$this->errors[] = 'Transport failed for the following addresses: "' . join('", "', $failedRecipients) . '".';
$this->error = 'Transport failed for the following addresses: "' . join('", "', $failedRecipients) . '".';
$this->errors[] = $this->error;
}
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
dol_syslog("CMailFile::sendfile: mail end error=". join(' ', $this->errors), LOG_ERR);
$res = false;

if (!empty($conf->global->MAIN_MAIL_DEBUG)) {
Expand Down

0 comments on commit cddbf3a

Please sign in to comment.