$backend = $mail->factory(common_config('mail', 'backend'),
common_config('mail', 'params') ?: array());
if ($_PEAR->isError($backend)) {
- throw new ServerException($backend->getMessage());
+ throw new EmailException($backend->getMessage(), $backend->getCode());
}
}
return $backend;
assert($backend); // throws an error if it's bad
$sent = $backend->send($recipients, $headers, $body);
if ($_PEAR->isError($sent)) {
- throw new ServerException($sent->getMessage());
+ throw new EmailException($sent->getMessage(), $sent->getCode());
}
return true;
} catch (PEAR_Exception $e) {