summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/ajax
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-07-29 18:01:43 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-07-30 10:07:20 -0400
commitb9bd54bd981b63b986571b8e90f9809bf8de67dc (patch)
tree5403d8f481c00bccdbe91b3a686ebcb639bd291c /apps/files_sharing/ajax
parentdab708b6255f5ca064c7471f74fa8cd795f093d6 (diff)
downloadnextcloud-server-b9bd54bd981b63b986571b8e90f9809bf8de67dc.tar.gz
nextcloud-server-b9bd54bd981b63b986571b8e90f9809bf8de67dc.zip
Add additional error handling for emailing private links
Diffstat (limited to 'apps/files_sharing/ajax')
-rw-r--r--apps/files_sharing/ajax/email.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/files_sharing/ajax/email.php b/apps/files_sharing/ajax/email.php
index e931e5f77e6..2a81e6f9827 100644
--- a/apps/files_sharing/ajax/email.php
+++ b/apps/files_sharing/ajax/email.php
@@ -9,4 +9,9 @@ $subject = $user.' shared a '.$type.' with you';
$link = $_POST['link'];
$text = $user.' shared the '.$type.' '.$_POST['file'].' with you. It is available for download here: '.$link;
$fromaddress = OCP\Config::getUserValue($user, 'settings', 'email', 'sharing-noreply@'.OCP\Util::getServerHost());
-OCP\Util::sendMail($_POST['toaddress'], $_POST['toaddress'], $subject, $text, $fromaddress, $user);
+try {
+ OCP\Util::sendMail($_POST['toaddress'], $_POST['toaddress'], $subject, $text, $fromaddress, $user);
+ OCP\JSON::success();
+} catch (Exception $exception) {
+ OCP\JSON::error(array('data' => array('message' => $exception->getMessage())));
+}