diff --git a/apps/files_sharing/ajax/email.php b/apps/files_sharing/ajax/email.php
deleted file mode 100644
index 4ed4eef723ae691b90d4194ca0a9323b2857ca94..0000000000000000000000000000000000000000
--- a/apps/files_sharing/ajax/email.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-OCP\JSON::checkLoggedIn();
-OCP\JSON::callCheck();
-OCP\JSON::checkAppEnabled('files_sharing');
-
-// read post variables
-$user = OCP\USER::getUser();
-$type = $_POST['type'];
-$link = $_POST['link'];
-$file = $_POST['file'];
-$to_address = $_POST['toaddress'];
-
-// enable l10n support
-$l = OC_L10N::get('files_sharing');
-
-// setup the email
-$subject = (string)$l->t('User %s shared a file with you', $user);
-if ($type === 'dir')
-	$subject = (string)$l->t('User %s shared a folder with you', $user);
-
-$text = (string)$l->t('User %s shared the file "%s" with you. It is available for download here: %s', array($user, $file, $link));
-if ($type === 'dir')
-	$text = (string)$l->t('User %s shared the folder "%s" with you. It is available for download here: %s', array($user, $file, $link));
-
-// handle localhost installations
-$server_host = OCP\Util::getServerHost();
-if ($server_host === 'localhost')
-	$server_host = "example.com";
-
-$default_from = 'sharing-noreply@' . $server_host;
-$from_address = OCP\Config::getUserValue($user, 'settings', 'email', $default_from );
-
-// send it out now
-try {
-	OCP\Util::sendMail($to_address, $to_address, $subject, $text, $from_address, $user);
-	OCP\JSON::success();
-} catch (Exception $exception) {
-	OCP\JSON::error(array('data' => array('message' => $exception->getMessage())));
-}
diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js
index a83252867a97541e0f8e88e68d0c17cae0b0a3af..8a546d62163d8ffa520d92eda8f8a6b86108844e 100644
--- a/apps/files_sharing/js/share.js
+++ b/apps/files_sharing/js/share.js
@@ -33,28 +33,4 @@ $(document).ready(function() {
 		});
 		OC.Share.loadIcons('file');
 	}
-
-    $('#emailPrivateLink').live('submit', function(event) {
-        event.preventDefault();
-        var link = $('#linkText').val();
-        var itemType = $('#dropdown').data('item-type');
-        var itemSource = $('#dropdown').data('item-source');
-
-        var file = $('tr').filterAttr('data-id', String(itemSource)).data('file');
-        var email = $('#email').val();
-        if (email != '') {
-            $.post(OC.filePath('files_sharing', 'ajax', 'email.php'), { toaddress: email, link: link, type: itemType, file: file }, function(result) {
-                if (result && result.status == 'success') {
-                    $('#email').css('font-weight', 'bold');
-                    $('#email').animate({ fontWeight: 'normal' }, 2000, function() {
-                        $(this).val('');
-                    }).val('Email sent');
-                } else {
-                    OC.dialogs.alert(result.data.message, 'Error while sharing');
-                }
-            });
-        }
-    });
-
-
-});
\ No newline at end of file
+});
diff --git a/core/ajax/share.php b/core/ajax/share.php
index 41832a3c65901aaee10c1b671b533994fe403f90..12206e0fd7927b51e4b9708497fb24a0b567882d 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -69,6 +69,42 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
 				($return) ? OC_JSON::success() : OC_JSON::error();
 			}
 			break;
+		case 'email':
+			// read post variables
+			$user = OCP\USER::getUser();
+			$type = $_POST['itemType'];
+			$link = $_POST['link'];
+			$file = $_POST['file'];
+			$to_address = $_POST['toaddress'];
+
+			// enable l10n support
+			$l = OC_L10N::get('core');
+
+			// setup the email
+			$subject = (string)$l->t('User %s shared a file with you', $user);
+			if ($type === 'dir')
+				$subject = (string)$l->t('User %s shared a folder with you', $user);
+
+			$text = (string)$l->t('User %s shared the file "%s" with you. It is available for download here: %s', array($user, $file, $link));
+			if ($type === 'dir')
+				$text = (string)$l->t('User %s shared the folder "%s" with you. It is available for download here: %s', array($user, $file, $link));
+
+			// handle localhost installations
+			$server_host = OCP\Util::getServerHost();
+			if ($server_host === 'localhost')
+				$server_host = "example.com";
+
+			$default_from = 'sharing-noreply@' . $server_host;
+			$from_address = OCP\Config::getUserValue($user, 'settings', 'email', $default_from );
+
+			// send it out now
+			try {
+				OCP\Util::sendMail($to_address, $to_address, $subject, $text, $from_address, $user);
+				OCP\JSON::success();
+			} catch (Exception $exception) {
+				OCP\JSON::error(array('data' => array('message' => $exception->getMessage())));
+			}
+			break;
 	}
 } else if (isset($_GET['fetch'])) {
 	switch ($_GET['fetch']) {
diff --git a/core/js/share.js b/core/js/share.js
index 962983e2f353300ed2537090b40cd2c0bd40c9a0..9f71f1bb66b884d68eaf2905b1e27e126194ed9e 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -555,4 +555,27 @@ $(document).ready(function() {
 		});
 	});
 
+
+    $('#emailPrivateLink').live('submit', function(event) {
+        event.preventDefault();
+        var link = $('#linkText').val();
+        var itemType = $('#dropdown').data('item-type');
+        var itemSource = $('#dropdown').data('item-source');
+        var file = $('tr').filterAttr('data-id', String(itemSource)).data('file');
+        var email = $('#email').val();
+        if (email != '') {
+            $.post(OC.filePath('core', 'ajax', 'share.php'), { action: 'email', toaddress: email, link: link, itemType: itemType, itemSource: itemSource, file: file}, function(result) {
+                if (result && result.status == 'success') {
+                    $('#email').css('font-weight', 'bold');
+                    $('#email').animate({ fontWeight: 'normal' }, 2000, function() {
+                        $(this).val('');
+                    }).val(t('core','Email sent'));
+                } else {
+                    OC.dialogs.alert(result.data.message, t('core', 'Error while sharing'));
+                }
+            });
+        }
+    });
+
+
 });