]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Report if the email was not sent!
authorMikael Nordfeldth <mmn@hethane.se>
Sun, 27 Dec 2015 01:16:12 +0000 (02:16 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Sun, 27 Dec 2015 01:16:12 +0000 (02:16 +0100)
lib/mail.php

index 7ac743bfee8d58fa9dae64de2bf3a0af0cfae725..a5e9efded1aba97c299f896ca1da959613b30954 100644 (file)
@@ -54,7 +54,7 @@ function mail_backend()
         $backend = $mail->factory(common_config('mail', 'backend'),
                                  common_config('mail', 'params') ?: array());
         if ($_PEAR->isError($backend)) {
-            common_server_error($backend->getMessage(), 500);
+            throw new ServerException($backend->getMessage());
         }
     }
     return $backend;
@@ -71,6 +71,8 @@ function mail_backend()
  */
 function mail_send($recipients, $headers, $body)
 {
+    global $_PEAR;
+
     try {
         // XXX: use Mail_Queue... maybe
         $backend = mail_backend();
@@ -81,6 +83,9 @@ function mail_send($recipients, $headers, $body)
 
         assert($backend); // throws an error if it's bad
         $sent = $backend->send($recipients, $headers, $body);
+        if ($_PEAR->isError($sent)) {
+            throw new ServerException($sent->getMessage());
+        }
         return true;
     } catch (PEAR_Exception $e) {
         common_log(