From: Roland Häder Date: Fri, 5 Mar 2010 15:45:00 +0000 (+0000) Subject: Logging of SMTP (PHPMailer) class errors added, old lost removed X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2c0f5aabd4c866f67705f36f7878dbc223daa9d8;p=mailer.git Logging of SMTP (PHPMailer) class errors added, old lost removed --- diff --git a/inc/functions.php b/inc/functions.php index 8cf9ab360b..eb0ba63455 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -599,13 +599,13 @@ Message : ' . htmlentities(utf8_decode($message)) . ' '); } elseif (($isHtml == 'Y') && (isExtensionActive('html_mail'))) { // Send mail as HTML away - sendHtmlEmail($toEmail, $subject, $message, $mailHeader); + return sendHtmlEmail($toEmail, $subject, $message, $mailHeader); } elseif (!empty($toEmail)) { // Send Mail away - sendRawEmail($toEmail, $subject, $message, $mailHeader); + return sendRawEmail($toEmail, $subject, $message, $mailHeader); } elseif ($isHtml != 'Y') { // Problem found! - sendRawEmail(getConfig('WEBMASTER'), '[PROBLEM:]' . $subject, $message, $mailHeader); + return sendRawEmail(getConfig('WEBMASTER'), '[PROBLEM:]' . $subject, $message, $mailHeader); } } @@ -665,9 +665,21 @@ function sendRawEmail ($toEmail, $subject, $message, $from) { $mail->AddCustomHeader('Errors-To:' . getConfig('WEBMASTER')); $mail->AddCustomHeader('X-Loop:' . getConfig('WEBMASTER')); $mail->Send(); + + // Has an error occured? + if (!empty($mail->ErrorInfo)) { + // Log message + logDebugMessage(__FUNCTION__, __LINE__, 'Error while sending mail: ' . $mail->ErrorInfo); + + // Raise an error + return false; + } else { + // All fine! + return true; + } } else { // Use legacy mail() command - mail($toEmail, $subject, decodeEntities($message), $from); + return mail($toEmail, $subject, decodeEntities($message), $from); } } diff --git a/inc/libs/uberwach_functions.php b/inc/libs/uberwach_functions.php index ece6ad2457..2347359adf 100644 --- a/inc/libs/uberwach_functions.php +++ b/inc/libs/uberwach_functions.php @@ -45,7 +45,7 @@ if (!defined('__SECURITY')) { // Loads the snippet for the uberwach action function loadUberwachSnippet () { // Simply load the template here - $GLOBALS['page_footer'] .= loadTemplate('uberwach_snippet', true, $content); + $GLOBALS['page_footer'] .= loadTemplate('uberwach_snippet', true); } // Filter for displaying uberwach snippet