]> git.mxchange.org Git - mailer.git/commitdiff
Logging of SMTP (PHPMailer) class errors added, old lost removed
authorRoland Häder <roland@mxchange.org>
Fri, 5 Mar 2010 15:45:00 +0000 (15:45 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 5 Mar 2010 15:45:00 +0000 (15:45 +0000)
inc/functions.php
inc/libs/uberwach_functions.php

index 8cf9ab360b268b84f8372def620004aad29e7df8..eb0ba63455b268642061309e2d03b24b16963fac 100644 (file)
@@ -599,13 +599,13 @@ Message : ' . htmlentities(utf8_decode($message)) . '
 </pre>');
        } 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);
        }
 }
 
index ece6ad2457503c220d31cab91f0fb7114af13b4c..2347359adf232f0f7a33a7a1b13e4829f64c8746 100644 (file)
@@ -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