diff --git a/apps/files_encryption/js/settings-admin.js b/apps/files_encryption/js/settings-admin.js
index c2140a6f1eb152692e8da411e21099660d5e329c..785d02002fa28caed4a438d8ff9c9a6086d23413 100644
--- a/apps/files_encryption/js/settings-admin.js
+++ b/apps/files_encryption/js/settings-admin.js
@@ -7,28 +7,6 @@
  * See the COPYING-README file.
  */
 
-OC.msg={
-	startSaving:function(selector){
-		$(selector)
-			.html( t('settings', 'Saving...') )
-			.removeClass('success')
-			.removeClass('error')
-			.stop(true, true)
-			.show();
-	},
-	finishedSaving:function(selector, data){
-		if( data.status === "success" ){
-			 $(selector).html( data.data.message )
-				.addClass('success')
-				.stop(true, true)
-				.delay(3000)
-				.fadeOut(900);
-		}else{
-			$(selector).html( data.data.message ).addClass('error');
-		}
-	}
-};
-
 $(document).ready(function(){
 	// Trigger ajax on recoveryAdmin status change
 	var enabledStatus = $('#adminEnableRecovery').val();
diff --git a/core/js/js.js b/core/js/js.js
index ec890be4541d736b366beccc8d1e9e361d71c055..21ccee0f1d54b6fc3af37d68bcc928aec75a1d16 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -467,6 +467,34 @@ OC.search.lastResults={};
 OC.addStyle.loaded=[];
 OC.addScript.loaded=[];
 
+OC.msg={
+	startSaving:function(selector){
+		OC.msg.startAction(selector, t('core', 'Saving...'));
+	},
+	finishedSaving:function(selector, data){
+		OC.msg.finishedAction(selector, data);
+	},
+	startAction:function(selector, message){
+		$(selector)
+			.html( message )
+			.removeClass('success')
+			.removeClass('error')
+			.stop(true, true)
+			.show();
+	},
+	finishedAction:function(selector, data){
+		if( data.status === "success" ){
+			$(selector).html( data.data.message )
+				.addClass('success')
+				.stop(true, true)
+				.delay(3000)
+				.fadeOut(900);
+		}else{
+			$(selector).html( data.data.message ).addClass('error');
+		}
+	}
+};
+
 OC.Notification={
 	queuedNotifications: [],
 	getDefaultNotificationFunction: null,
diff --git a/settings/admin.php b/settings/admin.php
index c0e4570658ad8f3504188260e0c39db66c2350ed..42477bfc1ca43506df1fc30661331ca560601c09 100755
--- a/settings/admin.php
+++ b/settings/admin.php
@@ -21,6 +21,16 @@ $entries=OC_Log_Owncloud::getEntries(3);
 $entriesremain = count(OC_Log_Owncloud::getEntries(4)) > 3;
 
 $tmpl->assign('loglevel', OC_Config::getValue( "loglevel", 2 ));
+$tmpl->assign('mail_domain', OC_Config::getValue( "mail_domain", '' ));
+$tmpl->assign('mail_from_address', OC_Config::getValue( "mail_from_address", '' ));
+$tmpl->assign('mail_smtpmode', OC_Config::getValue( "mail_smtpmode", '' ));
+$tmpl->assign('mail_smtpsecure', OC_Config::getValue( "mail_smtpsecure", '' ));
+$tmpl->assign('mail_smtphost', OC_Config::getValue( "mail_smtphost", '' ));
+$tmpl->assign('mail_smtpport', OC_Config::getValue( "mail_smtpport", '' ));
+$tmpl->assign('mail_smtpauthtype', OC_Config::getValue( "mail_smtpauthtype", '' ));
+$tmpl->assign('mail_smtpauth', OC_Config::getValue( "mail_smtpauth", false ));
+$tmpl->assign('mail_smtpname', OC_Config::getValue( "mail_smtpname", '' ));
+$tmpl->assign('mail_smtppassword', OC_Config::getValue( "mail_smtppassword", '' ));
 $tmpl->assign('entries', $entries);
 $tmpl->assign('entriesremain', $entriesremain);
 $tmpl->assign('htaccessworking', $htaccessworking);
diff --git a/settings/admin/controller.php b/settings/admin/controller.php
new file mode 100644
index 0000000000000000000000000000000000000000..a075d7743616c1df2e08ed1993b63f9a468f280b
--- /dev/null
+++ b/settings/admin/controller.php
@@ -0,0 +1,93 @@
+<?php
+/**
+* @author Joas Schilling
+* @copyright 2014 Joas Schilling nickvergessen@owncloud.com
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+* License as published by the Free Software Foundation; either
+* version 3 of the License, or any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+*
+* You should have received a copy of the GNU Affero General Public
+* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+namespace OC\Settings\Admin;
+
+class Controller {
+	/**
+	 * Set mail settings
+	 */
+	public static function setMailSettings() {
+		\OC_Util::checkAdminUser();
+		\OCP\JSON::callCheck();
+
+		$l = \OC_L10N::get('settings');
+
+		$smtp_settings = array(
+			'mail_domain'		=> null,
+			'mail_from_address'	=> null,
+			'mail_smtpmode'			=> array('sendmail', 'smtp', 'qmail', 'php'),
+			'mail_smtpsecure'		=> array('', 'ssl', 'tls'),
+			'mail_smtphost'		=> null,
+			'mail_smtpport'		=> null,
+			'mail_smtpauthtype'		=> array('LOGIN', 'PLAIN', 'NTLM'),
+			'mail_smtpauth'			=> true,
+			'mail_smtpname'		=> null,
+			'mail_smtppassword'	=> null,
+		);
+
+		foreach ($smtp_settings as $setting => $validate) {
+			if (!$validate) {
+				if (!isset($_POST[$setting]) || $_POST[$setting] === '') {
+					\OC_Config::deleteKey( $setting );
+				} else {
+					\OC_Config::setValue( $setting, $_POST[$setting] );
+				}
+			}
+			else if (is_bool($validate)) {
+				if (!empty($_POST[$setting])) {
+					\OC_Config::setValue( $setting, (bool) $_POST[$setting] );
+				} else {
+					\OC_Config::deleteKey( $setting );
+				}
+			}
+			else if (is_array($validate)) {
+				if (!isset($_POST[$setting]) || $_POST[$setting] === '') {
+					\OC_Config::deleteKey( $setting );
+				} else if (in_array($_POST[$setting], $validate)) {
+					\OC_Config::setValue( $setting, $_POST[$setting] );
+				} else {
+					$message = $l->t('Invalid value supplied for %s', array(self::getFieldname($setting, $l)));
+					\OC_JSON::error( array( "data" => array( "message" => $message)) );
+					exit;
+				}
+			}
+		}
+
+		\OC_JSON::success(array("data" => array( "message" => $l->t("Saved") )));
+	}
+
+	/**
+	 * Get the field name to use it in error messages
+	 *
+	 * @param $setting string
+	 * @param $l \OC_L10N
+	 * @return string
+	 */
+	public static function getFieldname($setting, $l) {
+		switch ($setting) {
+			case 'mail_smtpmode':
+				return $l->t( 'Send mode' );
+			case 'mail_smtpsecure':
+				return $l->t( 'Encryption' );
+			case 'mail_smtpauthtype':
+				return $l->t( 'Authentification method' );
+		}
+	}
+}
diff --git a/settings/css/settings.css b/settings/css/settings.css
index 60abbc108620a7b038fcb79ead2165288cfbe5bc..a47e7bf6563e9cde389b48d9a48fddbdfe9b899b 100644
--- a/settings/css/settings.css
+++ b/settings/css/settings.css
@@ -155,6 +155,18 @@ span.connectionwarning {color:#933; font-weight:bold; }
 input[type=radio] { width:1em; }
 table.shareAPI td { padding-bottom: 0.8em; }
 
+#mail_settings p label:first-child {
+	display: inline-block;
+	width: 300px;
+	text-align: right;
+}
+#mail_settings p select:nth-child(2) {
+	width: 143px;
+}
+#mail_smtpport {
+	width: 40px;
+}
+
 /* HELP */
 .pressed {background-color:#DDD;}
 
diff --git a/settings/js/admin.js b/settings/js/admin.js
index e957bd68f1fa309f4b8fe09345aeaf4ceba03fcb..5ea6a5af2df2db8980c7039bab6a3dbbb2a7b1c8 100644
--- a/settings/js/admin.js
+++ b/settings/js/admin.js
@@ -34,4 +34,38 @@ $(document).ready(function(){
 	$('#security').change(function(){
 		$.post(OC.filePath('settings','ajax','setsecurity.php'), { enforceHTTPS: $('#forcessl').val() },function(){} );
 	});
+
+	$('#mail_smtpauth').change(function() {
+		if (!this.checked) {
+			$('#mail_credentials').addClass('hidden');
+		} else {
+			$('#mail_credentials').removeClass('hidden');
+		}
+	});
+
+	$('#mail_smtpmode').change(function() {
+		if ($(this).val() !== 'smtp') {
+			$('#setting_smtpauth').addClass('hidden');
+			$('#setting_smtphost').addClass('hidden');
+			$('#mail_smtpsecure_label').addClass('hidden');
+			$('#mail_smtpsecure').addClass('hidden');
+			$('#mail_credentials').addClass('hidden');
+		} else {
+			$('#setting_smtpauth').removeClass('hidden');
+			$('#setting_smtphost').removeClass('hidden');
+			$('#mail_smtpsecure_label').removeClass('hidden');
+			$('#mail_smtpsecure').removeClass('hidden');
+			if ($('#mail_smtpauth').attr('checked')) {
+				$('#mail_credentials').removeClass('hidden');
+			}
+		}
+	});
+
+	$('#mail_settings').change(function(){
+		OC.msg.startSaving('#mail_settings .msg');
+		var post = $( "#mail_settings" ).serialize();
+		$.post(OC.Router.generate('settings_mail_settings'), post, function(data){
+			OC.msg.finishedSaving('#mail_settings .msg', data);
+		});
+	});
 });
diff --git a/settings/js/personal.js b/settings/js/personal.js
index 5944272067bab5a1575325ea9cbabffa9d994032..98bfe7132d488014ee2583a855edf5370ed6347e 100644
--- a/settings/js/personal.js
+++ b/settings/js/personal.js
@@ -315,25 +315,3 @@ OC.Encryption.msg={
 		}
 	}
 };
-
-OC.msg={
-	startSaving:function(selector){
-		$(selector)
-			.html( t('settings', 'Saving...') )
-			.removeClass('success')
-			.removeClass('error')
-			.stop(true, true)
-			.show();
-	},
-	finishedSaving:function(selector, data){
-		if( data.status === "success" ){
-			 $(selector).html( data.data.message )
-				.addClass('success')
-				.stop(true, true)
-				.delay(3000)
-				.fadeOut(900);
-		}else{
-			$(selector).html( data.data.message ).addClass('error');
-		}
-	}
-};
diff --git a/settings/routes.php b/settings/routes.php
index 895a9f5ccead91916334d751ffb70c3ada84648d..64f7122f0cf6492cbe0365e386f574df80ff4279 100644
--- a/settings/routes.php
+++ b/settings/routes.php
@@ -70,5 +70,8 @@ $this->create('settings_ajax_getlog', '/settings/ajax/getlog.php')
 	->actionInclude('settings/ajax/getlog.php');
 $this->create('settings_ajax_setloglevel', '/settings/ajax/setloglevel.php')
 	->actionInclude('settings/ajax/setloglevel.php');
+$this->create('settings_mail_settings', '/settings/admin/mailsettings')
+	->post()
+	->action('OC\Settings\Admin\Controller', 'setMailSettings');
 $this->create('settings_ajax_setsecurity', '/settings/ajax/setsecurity.php')
 	->actionInclude('settings/ajax/setsecurity.php');
diff --git a/settings/templates/admin.php b/settings/templates/admin.php
index 0eabffb9316ff4a5a2a7cd036d21d88bf1686666..139a9dd076c11816992d1444575b4b8f0701e2fb 100644
--- a/settings/templates/admin.php
+++ b/settings/templates/admin.php
@@ -11,6 +11,27 @@ $levelLabels = array(
 	$l->t( 'Errors and fatal issues' ),
 	$l->t( 'Fatal issues only' ),
 );
+
+$mail_smtpauthtype = array(
+	''	=> $l->t('None'),
+	'LOGIN'	=> $l->t('Login'),
+	'PLAIN'	=> $l->t('Plain'),
+	'NTLM'	=> $l->t('NT LAN Manager'),
+);
+
+$mail_smtpsecure = array(
+	''		=> $l->t('None'),
+	'ssl'	=> $l->t('SSL'),
+	'tls'	=> $l->t('TLS'),
+);
+
+$mail_smtpmode = array(
+	'sendmail',
+	'smtp',
+	'qmail',
+	'php',
+);
+
 ?>
 
 <?php
@@ -250,6 +271,84 @@ if (!$_['internetconnectionworking']) {
 	</table>
 </fieldset>
 
+<fieldset id="mail_settings" class="personalblock">
+	<h2><?php p($l->t('Email Server'));?> <span class="msg"></span></h2>
+
+	<p><?php p($l->t('This is used for sending out notifications.')); ?></p>
+
+	<p>
+		<label for="mail_smtpmode"><?php p($l->t( 'Send mode' )); ?></label> 
+		<select name='mail_smtpmode' id='mail_smtpmode'>
+			<?php foreach ($mail_smtpmode as $smtpmode):
+				$selected = '';
+				if ($smtpmode == $_['mail_smtpmode']):
+					$selected = 'selected="selected"';
+				endif; ?>
+				<option value='<?php p($smtpmode)?>' <?php p($selected) ?>><?php p($smtpmode) ?></option>
+			<?php endforeach;?>
+		</select>
+
+		<label id="mail_smtpsecure_label" for="mail_smtpsecure"
+			   <?php if ($_['mail_smtpmode'] != 'smtp') print_unescaped(' class="hidden"'); ?>>
+			<?php p($l->t( 'Encryption' )); ?>
+		</label>
+		<select name="mail_smtpsecure" id="mail_smtpsecure"
+				<?php if ($_['mail_smtpmode'] != 'smtp') print_unescaped(' class="hidden"'); ?>>
+			<?php foreach ($mail_smtpsecure as $secure => $name):
+				$selected = '';
+				if ($secure == $_['mail_smtpsecure']):
+					$selected = 'selected="selected"';
+				endif; ?>
+				<option value='<?php p($secure)?>' <?php p($selected) ?>><?php p($name) ?></option>
+			<?php endforeach;?>
+		</select>
+	</p>
+
+	<p>
+		<label for="mail_from_address"><?php p($l->t( 'From address' )); ?></label>
+		<input type="text" name='mail_from_address' id="mail_from_address" placeholder="<?php p('mail')?>"
+			   value='<?php p($_['mail_from_address']) ?>' />
+		@
+		<input type="text" name='mail_domain' id="mail_domain" placeholder="<?php p('example.com')?>"
+			   value='<?php p($_['mail_domain']) ?>' />
+	</p>
+
+	<p id="setting_smtpauth" <?php if ($_['mail_smtpmode'] != 'smtp') print_unescaped(' class="hidden"'); ?>>
+		<label for="mail_smtpauthtype"><?php p($l->t( 'Authentification method' )); ?></label>
+		<select name='mail_smtpauthtype' id='mail_smtpauthtype'>
+			<?php foreach ($mail_smtpauthtype as $authtype => $name):
+				$selected = '';
+				if ($authtype == $_['mail_smtpauthtype']):
+					$selected = 'selected="selected"';
+				endif; ?>
+				<option value='<?php p($authtype)?>' <?php p($selected) ?>><?php p($name) ?></option>
+			<?php endforeach;?>
+		</select>
+
+		<input type="checkbox" name="mail_smtpauth" id="mail_smtpauth" value="1"
+			   <?php if ($_['mail_smtpauth']) print_unescaped('checked="checked"'); ?> />
+		<label for="mail_smtpauth"><?php p($l->t( 'Authentication required' )); ?></label>
+	</p>
+
+	<p id="setting_smtphost" <?php if ($_['mail_smtpmode'] != 'smtp') print_unescaped(' class="hidden"'); ?>>
+		<label for="mail_smtphost"><?php p($l->t( 'Server address' )); ?></label>
+		<input type="text" name='mail_smtphost' id="mail_smtphost" placeholder="<?php p('smtp.example.com')?>"
+			   value='<?php p($_['mail_smtphost']) ?>' />
+		:
+		<input type="text" name='mail_smtpport' id="mail_smtpport" placeholder="<?php p($l->t('Port'))?>"
+			   value='<?php p($_['mail_smtpport']) ?>' />
+	</p>
+
+	<p id="mail_credentials" <?php if (!$_['mail_smtpauth'] || $_['mail_smtpmode'] != 'smtp') print_unescaped(' class="hidden"'); ?>>
+		<label for="mail_smtpname"><?php p($l->t( 'Credentials' )); ?></label>
+		<input type="text" name='mail_smtpname' id="mail_smtpname" placeholder="<?php p($l->t('SMTP Username'))?>"
+			   value='<?php p($_['mail_smtpname']) ?>' />
+		<input type="password" name='mail_smtppassword' id="mail_smtppassword"
+			   placeholder="<?php p($l->t('SMTP Password'))?>" value='<?php p($_['mail_smtppassword']) ?>' />
+	</p>
+
+</fieldset>
+
 <fieldset class="personalblock">
 	<h2><?php p($l->t('Log'));?></h2>
 	<?php p($l->t('Log level'));?> <select name='loglevel' id='loglevel'>