Changeset:
        a5ca3ce5251a
        
https://sourceforge.net/p/mrbs/hg-code/ci/a5ca3ce5251a60f719be83b44f7770ca4b892581
Author:
        Campbell Morrison <[email protected]>
Date:
        Thu Sep 24 16:31:34 2015 +0100
Log message:

Improved error handling when sending mail

diffstat:

 web/functions_mail.inc |  31 ++++++++++++++-----------------
 1 files changed, 14 insertions(+), 17 deletions(-)

diffs (42 lines):

diff -r f17aa5051c22 -r a5ca3ce5251a web/functions_mail.inc
--- a/web/functions_mail.inc    Wed Sep 23 11:52:48 2015 +0100
+++ b/web/functions_mail.inc    Thu Sep 24 16:31:34 2015 +0100
@@ -1335,24 +1335,21 @@
   }
   $mail->set('MIMEHeader', $mime_header);
 
-  $mail->preSend();
+  if ($mail->preSend())
+  {
+    $mail->set('MIMEBody', $mime['body']);
+    mail_debug("Using backend '" . $mail_settings['admin_backend'] . "'");
+    mail_debug("Recipients: '$recipients'");
+    if ($mail->postSend())
+    {
+      mail_debug('Email sent successfully');
+      return true;
+    }
+  }
   
-  $mail->set('MIMEBody', $mime['body']);
-
-  mail_debug("Using backend '" . $mail_settings['admin_backend'] . "'");
-  mail_debug("Recipients: '$recipients'");
+  error_log('Error sending email: ' . $mail->ErrorInfo);
+  mail_debug('Failed to send email: ' . $mail->ErrorInfo);
+  return false;
   
-  if (!$mail->postSend())
-  {
-    error_log('Error sending email: ' . $mail->ErrorInfo);
-    mail_debug('Failed to send email: ' . $mail->ErrorInfo);
-    return false;
-  }
-
-  mail_debug('Email sent successfully');
-  
-  return true;
 }
 
-// }}}
-

------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to