mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-08 09:01:40 +01:00
Sync transifex
Debug v17
This commit is contained in:
@@ -838,6 +838,10 @@ class CMailFile
|
||||
$this->error .= ".<br>";
|
||||
$this->error .= $langs->trans("ErrorPhpMailDelivery");
|
||||
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
|
||||
|
||||
if (!empty($conf->global->MAIN_MAIL_DEBUG)) {
|
||||
$this->save_dump_mail_in_err();
|
||||
}
|
||||
} else {
|
||||
dol_syslog("CMailFile::sendfile: mail end success", LOG_DEBUG);
|
||||
}
|
||||
@@ -902,6 +906,7 @@ class CMailFile
|
||||
|
||||
if (getDolGlobalString($keyforsmtpauthtype) === "XOAUTH2") {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php'; // define $supportedoauth2array
|
||||
|
||||
$keyforsupportedoauth2array = $conf->global->$keyforsmtpoauthservice;
|
||||
if (preg_match('/^.*-/', $keyforsupportedoauth2array)) {
|
||||
$keyforprovider = preg_replace('/^.*-/', '', $keyforsupportedoauth2array);
|
||||
@@ -993,6 +998,10 @@ class CMailFile
|
||||
}
|
||||
dol_syslog("CMailFile::sendfile: mail end error with smtps lib to HOST=".$server.", PORT=".$conf->global->$keyforsmtpport." - ".$this->error, LOG_ERR);
|
||||
$res = false;
|
||||
|
||||
if (!empty($conf->global->MAIN_MAIL_DEBUG)) {
|
||||
$this->save_dump_mail_in_err();
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($this->sendmode == 'swiftmailer') {
|
||||
@@ -1028,6 +1037,7 @@ class CMailFile
|
||||
}
|
||||
if (getDolGlobalString($keyforsmtpauthtype) === "XOAUTH2") {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php'; // define $supportedoauth2array
|
||||
|
||||
$keyforsupportedoauth2array = getDolGlobalString($keyforsmtpoauthservice);
|
||||
if (preg_match('/^.*-/', $keyforsupportedoauth2array)) {
|
||||
$keyforprovider = preg_replace('/^.*-/', '', $keyforsupportedoauth2array);
|
||||
@@ -1108,6 +1118,7 @@ class CMailFile
|
||||
$this->mailer->registerPlugin(new Swift_Plugins_LoggerPlugin($this->logger));
|
||||
}
|
||||
// send mail
|
||||
$failedRecipients = array();
|
||||
try {
|
||||
$result = $this->mailer->send($this->message, $failedRecipients);
|
||||
} catch (Exception $e) {
|
||||
@@ -1124,6 +1135,10 @@ class CMailFile
|
||||
}
|
||||
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
|
||||
$res = false;
|
||||
|
||||
if (!empty($conf->global->MAIN_MAIL_DEBUG)) {
|
||||
$this->save_dump_mail_in_err();
|
||||
}
|
||||
} else {
|
||||
dol_syslog("CMailFile::sendfile: mail end success", LOG_DEBUG);
|
||||
}
|
||||
@@ -1211,7 +1226,7 @@ class CMailFile
|
||||
|
||||
if (@is_writeable($dolibarr_main_data_root)) { // Avoid fatal error on fopen with open_basedir
|
||||
$outputfile = $dolibarr_main_data_root."/dolibarr_mail.log";
|
||||
$fp = fopen($outputfile, "w");
|
||||
$fp = fopen($outputfile, "w"); // overwrite
|
||||
|
||||
if ($this->sendmode == 'mail') {
|
||||
fputs($fp, $this->headers);
|
||||
@@ -1230,6 +1245,25 @@ class CMailFile
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Save content if mail is in error
|
||||
* Used for debugging.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function save_dump_mail_in_err()
|
||||
{
|
||||
global $dolibarr_main_data_root;
|
||||
|
||||
if (@is_writeable($dolibarr_main_data_root)) { // Avoid fatal error on fopen with open_basedir
|
||||
$srcfile = $dolibarr_main_data_root."/dolibarr_mail.log";
|
||||
$destfile = $dolibarr_main_data_root."/dolibarr_mail.err";
|
||||
|
||||
dol_move($srcfile, $destfile, 0, 1, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Correct an uncomplete html string
|
||||
|
||||
Reference in New Issue
Block a user