X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fmail.php;h=da22eb6715a1b2c333ae0cf60f6271f513e373f5;hb=57163e6fd69d560b462a1b9eaee054126e029703;hp=7ac743bfee8d58fa9dae64de2bf3a0af0cfae725;hpb=7a106f6669a62e401fc0c4c09c6c6859328ec3a2;p=quix0rs-gnu-social.git diff --git a/lib/mail.php b/lib/mail.php index 7ac743bfee..da22eb6715 100644 --- a/lib/mail.php +++ b/lib/mail.php @@ -30,9 +30,7 @@ * @link http://status.net/ */ -if (!defined('STATUSNET') && !defined('LACONICA')) { - exit(1); -} +if (!defined('GNUSOCIAL')) { exit(1); } require_once 'Mail.php'; @@ -54,7 +52,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 EmailException($backend->getMessage(), $backend->getCode()); } } return $backend; @@ -71,6 +69,8 @@ function mail_backend() */ function mail_send($recipients, $headers, $body) { + global $_PEAR; + try { // XXX: use Mail_Queue... maybe $backend = mail_backend(); @@ -81,6 +81,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 EmailException($sent->getMessage(), $sent->getCode()); + } return true; } catch (PEAR_Exception $e) { common_log(