diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php
index a2609fb96f6d1c0797beaefbd5fb526022eedbf9..54bbce1904075404de5a2e6e5ca233671380fdca 100644
--- a/interface/lib/classes/tform.inc.php
+++ b/interface/lib/classes/tform.inc.php
@@ -216,6 +216,7 @@ class tform {
 			$querystring = str_replace("{GROUPS}",$_SESSION["s"]["user"]["groups"],$querystring);
 			$table_idx = $this->formDef['db_table_idx'];
 			$querystring = str_replace("{RECORDID}",$record[$table_idx],$querystring);
+			$querystring = str_replace("{AUTHSQL}",$this->getAuthSQL('r'),$querystring);
 			
 			// Getting the records
 			$tmp_records = $app->db->queryAllRecords($querystring);
diff --git a/interface/lib/classes/tform_actions.inc.php b/interface/lib/classes/tform_actions.inc.php
index 7d4095618a96e3caf6b8faefee571c165b0e3e76..c46537e39015e303ea7aca9df3ca754a9fa1a1ad 100644
--- a/interface/lib/classes/tform_actions.inc.php
+++ b/interface/lib/classes/tform_actions.inc.php
@@ -233,7 +233,15 @@ class tform_actions {
 			}
 		}
 
-		header("Location: ".$liste["file"]."?PHPSESSID=".$_SESSION["s"]["id"]);
+		//header("Location: ".$liste["file"]."?PHPSESSID=".$_SESSION["s"]["id"]);
+		if($_SESSION["s"]["form"]["return_to"] != '') {
+			$list_name = $_SESSION["s"]["form"]["return_to"];
+			$redirect = "Location: ".$_SESSION["s"]["list"][$list_name]["parent_script"]."?id=".$_SESSION["s"]["list"][$list_name]["parent_id"]."&next_tab=".$_SESSION["s"]["list"][$list_name]["parent_tab"];
+			unset($_SESSION["s"]["form"]["return_to"]);
+			header($redirect);
+		} else {
+    		header("Location: ".$liste["file"]);
+		}
 		exit;
 		
 	}
diff --git a/interface/web/sites/form/mail_alias.tform.php b/interface/web/sites/form/mail_alias.tform.php
index 05671ce2ffa05600689a9012c5cbb73efdea37fc..a4a4f3dc9449f288ac9e0d7d7dce0e3242ac70b4 100644
--- a/interface/web/sites/form/mail_alias.tform.php
+++ b/interface/web/sites/form/mail_alias.tform.php
@@ -40,8 +40,8 @@ $form["action"]			= "mail_alias_edit.php";
 $form["db_table"]		= "mail_redirect";
 $form["db_table_idx"]	= "redirect_id";
 $form["db_history"]		= "yes";
-$form["tab_default"]	= "mailbox";
-$form["list_default"]	= "mail_box_list.php";
+$form["tab_default"]	= "alias";
+$form["list_default"]	= "mail_alias_list.php";
 $form["auth"]			= 'yes'; // yes / no
 
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
@@ -50,10 +50,10 @@ $form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
-$form["tabs"]['mailbox'] = array (
-	'title' 	=> "Mailbox",
+$form["tabs"]['alias'] = array (
+	'title' 	=> "Email alias",
 	'width' 	=> 100,
-	'template' 	=> "templates/mail_box_mailbox_edit.htm",
+	'template' 	=> "templates/mail_alias_edit.htm",
 	'fields' 	=> array (
 	##################################
 	# Begin Datatable fields
@@ -79,44 +79,24 @@ $form["tabs"]['mailbox'] = array (
 			'width'		=> '30',
 			'maxlength'	=> '255'
 		),
-		'cryptpwd' => array (
+		'destination' => array (
 			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
-			'encryption'=> 'CRYPT',
+			'formtype'	=> 'SELECT',
 			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'active' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> '1',
-			'value'		=> '1'
+			'datasource'	=> array ( 	'type'			=> 'SQL',
+										'querystring' 	=> 'SELECT email FROM mail_box WHERE {AUTHSQL} ORDER BY email',
+										'keyfield'		=> 'email',
+										'valuefield'	=> 'email'
+									 ),
+			'value'		=> ''
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
-	)
-);
-
-$form["tabs"]['autoresponder'] = array (
-	'title' 	=> "Autoresponder",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_box_autoresponder_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
-		'autoresponder_text' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
+		'type' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'SELECT',
 			'default'	=> '',
-			'value'		=> '',
-			'cols'		=> '30',
-			'rows'		=> '15'
+			'value'		=> array('alias' => 'Alias','forward'=>'Forward')
 		),
-		'autoresponder' => array (
+		'active' => array (
 			'datatype'	=> 'INTEGER',
 			'formtype'	=> 'CHECKBOX',
 			'default'	=> '1',
@@ -129,4 +109,5 @@ $form["tabs"]['autoresponder'] = array (
 );
 
 
+
 ?>
\ No newline at end of file
diff --git a/interface/web/sites/lib/module.conf.php b/interface/web/sites/lib/module.conf.php
index 5a06587c203cdf212cb29803e23122926fd8e7a3..a36f049d3adcfd43e0d9bfb60ba4cdc600fded0e 100644
--- a/interface/web/sites/lib/module.conf.php
+++ b/interface/web/sites/lib/module.conf.php
@@ -42,19 +42,19 @@ $module = array (
         array (
           'title' => 'Email Alias',
           'target' => 'content',
-          'link' => '',
+          'link' => 'sites/mail_alias_list.php',
         ),
         5 => 
         array (
           'title' => 'Email Forward',
           'target' => 'content',
-          'link' => '',
+          'link' => 'sites/mail_forward_list.php',
         ),
         6 => 
         array (
           'title' => 'Email Catchall',
           'target' => 'content',
-          'link' => '',
+          'link' => 'sites/mail_catchall_list.php',
         ),
       ),
     ),
@@ -68,13 +68,13 @@ $module = array (
         array (
           'title' => 'Email Whitelist',
           'target' => 'content',
-          'link' => '',
+          'link' => 'sites/mail_whitelist_list.php',
         ),
         1 => 
         array (
           'title' => 'Email Blacklist',
           'target' => 'content',
-          'link' => '',
+          'link' => 'sites/mail_blacklist_list.php',
         ),
       ),
     ),
diff --git a/interface/web/sites/list/mail_alias.list.php b/interface/web/sites/list/mail_alias.list.php
new file mode 100644
index 0000000000000000000000000000000000000000..4f32455f30b55472d5604e97db1ea6e7e491f258
--- /dev/null
+++ b/interface/web/sites/list/mail_alias.list.php
@@ -0,0 +1,69 @@
+<?php
+
+/*
+	Datatypes:
+	- INTEGER
+	- DOUBLE
+	- CURRENCY
+	- VARCHAR
+	- TEXT
+	- DATE
+*/
+
+
+
+// Name of the list
+$liste["name"] 				= "mail_alias";
+
+// Database table
+$liste["table"] 			= "mail_redirect";
+
+// Index index field of the database table
+$liste["table_idx"]			= "redirect_id";
+
+// Search Field Prefix
+$liste["search_prefix"] 	= "search_";
+
+// Records per page
+$liste["records_per_page"] 	= 15;
+
+// Script File of the list
+$liste["file"]				= "mail_alias_list.php";
+
+// Script file of the edit form
+$liste["edit_file"]			= "mail_alias_edit.php";
+
+// Script File of the delete script
+$liste["delete_file"]		= "mail_alias_del.php";
+
+// Paging Template
+$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+
+// Enable auth
+$liste["auth"]				= "yes";
+
+
+/*****************************************************
+* Suchfelder
+*****************************************************/
+
+$liste["item"][] = array(	'field'		=> "email",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "TEXT",
+							'op'		=> "like",
+							'prefix'	=> "%",
+							'suffix'	=> "%",
+							'width'		=> "",
+							'value'		=> "");
+
+$liste["item"][] = array(	'field'		=> "destination",
+							'datatype'	=> "VARCHAR",
+							'formtype'	=> "TEXT",
+							'op'		=> "like",
+							'prefix'	=> "%",
+							'suffix'	=> "%",
+							'width'		=> "",
+							'value'		=> "");
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/sites/mail_alias_del.php b/interface/web/sites/mail_alias_del.php
new file mode 100644
index 0000000000000000000000000000000000000000..03b95ca7ed9ee5d713d0659404ca781b57e2a38c
--- /dev/null
+++ b/interface/web/sites/mail_alias_del.php
@@ -0,0 +1,54 @@
+<?php
+
+/*
+Copyright (c) 2005, Till Brehm, projektfarm Gmbh
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    * Neither the name of ISPConfig nor the names of its contributors
+      may be used to endorse or promote products derived from this software without
+      specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$list_def_file = "list/mail_alias.list.php";
+$tform_def_file = "form/mail_alias.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+// Checke Berechtigungen für Modul
+if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
+	header("Location: ../index.php");
+	exit;
+}
+
+$app->uses("tform_actions");
+$app->tform_actions->onDelete();
+
+?>
\ No newline at end of file
diff --git a/interface/web/sites/mail_alias_edit.php b/interface/web/sites/mail_alias_edit.php
new file mode 100644
index 0000000000000000000000000000000000000000..1927eb8d274e8fb6e4bfe41d05d31871bb5880c9
--- /dev/null
+++ b/interface/web/sites/mail_alias_edit.php
@@ -0,0 +1,99 @@
+<?php
+/*
+Copyright (c) 2005, Till Brehm, projektfarm Gmbh
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    * Neither the name of ISPConfig nor the names of its contributors
+      may be used to endorse or promote products derived from this software without
+      specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$tform_def_file = "form/mail_alias.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+// Checking module permissions
+if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
+	header("Location: ../index.php");
+	exit;
+}
+
+// Loading classes
+$app->uses('tpl,tform,tform_actions');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+	
+	function onShowEnd() {
+		global $app, $conf;
+		
+		$email = $this->dataRecord["email"];
+		$email_parts = explode("@",$email);
+		$app->tpl->setVar("email_local_part",$email_parts[0]);
+		
+		// Getting Domains of the user
+		$sql = "SELECT domain FROM mail_domain WHERE type = 'local' AND ".$app->tform->getAuthSQL('r');
+		$domains = $app->db->queryAllRecords($sql);
+		$domain_select = '';
+		foreach( $domains as $domain) {
+			$selected = ($domain["domain"] == $email_parts[1])?'SELECTED':'';
+			$domain_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n";
+		}
+		$app->tpl->setVar("email_domain",$domain_select);
+		
+		parent::onShowEnd();
+	}
+	
+	function onSubmit() {
+		global $app, $conf;
+		
+		// Check if Domain belongs to user
+		$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($_POST["email_domain"])."' AND ".$app->tform->getAuthSQL('r'));
+		if($domain["domain"] != $_POST["email_domain"]) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
+		 		
+		// compose the email field
+		$this->dataRecord["email"] = $_POST["email_local_part"]."@".$_POST["email_domain"];
+		// Set the server id of the mailbox = server ID of mail domain.
+		$this->dataRecord["server_id"] = $domain["server_id"];
+		
+		unset($this->dataRecord["email_local_part"]);
+		unset($this->dataRecord["email_domain"]);
+		
+		parent::onSubmit();
+	}
+	
+}
+
+$page = new page_action;
+$page->onLoad();
+
+?>
\ No newline at end of file
diff --git a/interface/web/sites/mail_alias_list.php b/interface/web/sites/mail_alias_list.php
new file mode 100644
index 0000000000000000000000000000000000000000..d3646fc01cce1b61022df151172fe38b9750c72a
--- /dev/null
+++ b/interface/web/sites/mail_alias_list.php
@@ -0,0 +1,26 @@
+<?php
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$list_def_file = "list/mail_alias.list.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+// Checking module permissions
+if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
+	header("Location: ../index.php");
+	exit;
+}
+
+$app->uses('listform_actions');
+
+$app->listform_actions->onLoad();
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/sites/mail_box_edit.php b/interface/web/sites/mail_box_edit.php
index e01137aaecd9d4c2a4a2bbf055f14367dc1d79bc..715964f23953b3eca17534446fa6c8f61ab7c87f 100644
--- a/interface/web/sites/mail_box_edit.php
+++ b/interface/web/sites/mail_box_edit.php
@@ -51,8 +51,6 @@ if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"]))
 $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
-die(print_r($_SESSION));
-
 class page_action extends tform_actions {
 	
 	function onShowEnd() {