diff --git a/install/sql/incremental/upd_0063.sql b/install/sql/incremental/upd_0063.sql
index 6c094662bd3f3a4fd7cd8fabcd4a7ef316e3d8f7..77baa0e65535f5e7d89368068de2da1887f94655 100644
--- a/install/sql/incremental/upd_0063.sql
+++ b/install/sql/incremental/upd_0063.sql
@@ -1,2 +1,15 @@
 ALTER TABLE `client` ADD `limit_domainmodule` INT NOT NULL DEFAULT '0';
 ALTER TABLE `client_template` ADD `limit_domainmodule` INT NOT NULL DEFAULT '0';
+CREATE TABLE `client_message_template` (
+  `client_message_template_id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `sys_userid` int(11) NOT NULL DEFAULT '0',
+  `sys_groupid` int(11) NOT NULL DEFAULT '0',
+  `sys_perm_user` varchar(5) DEFAULT NULL,
+  `sys_perm_group` varchar(5) DEFAULT NULL,
+  `sys_perm_other` varchar(5) DEFAULT NULL,
+  `template_type` varchar(255) DEFAULT NULL,
+  `template_name` varchar(255) DEFAULT NULL,
+  `subject` varchar(255) DEFAULT NULL,
+  `message` text,
+  PRIMARY KEY (`client_message_template_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
\ No newline at end of file
diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql
index 600b853dcc16c9d7377df8c525b4671ed2486ef3..5dcd4bb06732fb215bda46956f24ee8d13a0267f 100644
--- a/install/sql/ispconfig3.sql
+++ b/install/sql/ispconfig3.sql
@@ -340,6 +340,30 @@ CREATE TABLE `client_template_assigned` (
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 -- --------------------------------------------------------
 
+--
+-- Table structure for table `invoice_message_template`
+--
+
+CREATE TABLE `client_message_template` (
+  `client_message_template_id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `sys_userid` int(11) NOT NULL DEFAULT '0',
+  `sys_groupid` int(11) NOT NULL DEFAULT '0',
+  `sys_perm_user` varchar(5) DEFAULT NULL,
+  `sys_perm_group` varchar(5) DEFAULT NULL,
+  `sys_perm_other` varchar(5) DEFAULT NULL,
+  `template_type` varchar(255) DEFAULT NULL,
+  `template_name` varchar(255) DEFAULT NULL,
+  `subject` varchar(255) DEFAULT NULL,
+  `message` text,
+  PRIMARY KEY (`client_message_template_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `invoice_message_template`
+--
+
+-- --------------------------------------------------------
+
 --
 -- Table structure for table `country`
 --
diff --git a/interface/web/client/client_edit.php b/interface/web/client/client_edit.php
index 33408d2ce6c1e3c18352fd4a5bee38eef342257b..d16d9031d0ad409da5530b899bbe9a71a4db1bb4 100644
--- a/interface/web/client/client_edit.php
+++ b/interface/web/client/client_edit.php
@@ -334,6 +334,48 @@ class page_action extends tform_actions {
 				}
 			}
 		}
+		
+		//* Send welcome email
+		$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
+		$sql = "SELECT * FROM client_message_template WHERE template_type = 'welcome' AND sys_groupid = ".$client_group_id;
+		$email_template = $app->db->queryOneRecord($sql);
+		$client = $app->tform->getDataRecord($this->id);
+
+		if(is_array($email_template) && $client['email'] != '') {
+			//* Parse client details into message
+			$message = $email_template['message'];
+			$subject = $email_template['subject'];
+			foreach($client as $key => $val) {
+				switch ($key) {
+				case 'password':
+					$message = str_replace('{password}', $this->dataRecord['password'], $message);
+					$subject = str_replace('{password}', $this->dataRecord['password'], $subject);
+					break;
+				case 'gender':
+					$message = str_replace('{salutation}', $wb['gender_'.$val.'_txt'], $message);
+					$subject = str_replace('{salutation}', $wb['gender_'.$val.'_txt'], $subject);
+					break;
+				default:
+					$message = str_replace('{'.$key.'}', $val, $message);
+					$subject = str_replace('{'.$key.'}', $val, $subject);
+				}
+			}
+			
+			//* Get sender address
+			if($app->auth->is_admin()) {
+				$app->uses('getconf');
+				$system_config = $app->getconf->get_global_config();
+				$from = $system_config['admin_mail'];
+			} else {
+				$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
+				$reseller = $app->db->queryOneRecord("SELECT client.email FROM sys_group,client WHERE client.client_id = sys_group.client_id and sys_group.groupid = ".$client_group_id);
+				$from = $reseller["email"];
+			}
+
+			//* Send the email
+			$app->functions->mail($client['email'], $subject, $message, $from);
+		}
+		
 
 		parent::onAfterInsert();
 	}
diff --git a/interface/web/client/client_message.php b/interface/web/client/client_message.php
index 199fc6927e71a86e510a5831a9d6a5cf13f787eb..5707e88206be5b02ffe24d8be088f3d14d184b2b 100644
--- a/interface/web/client/client_message.php
+++ b/interface/web/client/client_message.php
@@ -146,7 +146,7 @@ if($_SESSION["s"]["user"]["typ"] == 'admin'){
 
 //message variables
 $message_variables = '';
-$sql = "SHOW COLUMNS FROM client WHERE Field NOT IN ('client_id', 'sys_userid', 'sys_groupid', 'sys_perm_user', 'sys_perm_group', 'sys_perm_other', 'password', 'parent_client_id', 'id_rsa', 'ssh_rsa', 'created_at', 'default_mailserver', 'default_webserver', 'web_php_options', 'ssh_chroot', 'default_dnsserver', 'default_dbserver', 'template_master', 'template_additional') AND Field NOT LIKE 'limit_%'";
+$sql = "SHOW COLUMNS FROM client WHERE Field NOT IN ('client_id', 'sys_userid', 'sys_groupid', 'sys_perm_user', 'sys_perm_group', 'sys_perm_other', 'password', 'parent_client_id', 'id_rsa', 'ssh_rsa', 'created_at', 'default_mailserver', 'default_webserver', 'web_php_options', 'ssh_chroot', 'default_dnsserver', 'default_dbserver', 'template_master', 'template_additional', 'force_suexec', 'default_slave_dnsserver', 'usertheme', 'locked', 'canceled', 'can_use_api', 'tmp_data', 'customer_no_template', 'customer_no_start', 'customer_no_counter', 'added_date', 'added_by') AND Field NOT LIKE 'limit_%'";
 $field_names = $app->db->queryAllRecords($sql);
 if(!empty($field_names) && is_array($field_names)){
 	foreach($field_names as $field_name){
diff --git a/interface/web/client/form/message_template.tform.php b/interface/web/client/form/message_template.tform.php
new file mode 100644
index 0000000000000000000000000000000000000000..421b1af71374040e6c7a60bdb64b04481fdd679d
--- /dev/null
+++ b/interface/web/client/form/message_template.tform.php
@@ -0,0 +1,108 @@
+<?php
+
+/*
+	Form Definition
+
+	Tabledefinition
+
+	Datatypes:
+	- INTEGER (Forces the input to Int)
+	- DOUBLE
+	- CURRENCY (Formats the values to currency notation)
+	- VARCHAR (no format check, maxlength: 255)
+	- TEXT (no format check)
+	- DATE (Dateformat, automatic conversion to timestamps)
+
+	Formtype:
+	- TEXT (Textfield)
+	- TEXTAREA (Textarea)
+	- PASSWORD (Password textfield, input is not shown when edited)
+	- SELECT (Select option field)
+	- RADIO
+	- CHECKBOX
+	- CHECKBOXARRAY
+	- FILE
+
+	VALUE:
+	- Wert oder Array
+
+	Hint:
+	The ID field of the database table is not part of the datafield definition.
+	The ID field must be always auto incement (int or bigint).
+
+
+*/
+
+$form["title"]    = "Email template";
+$form["description"]  = "";
+$form["name"]    = "client_message_template";
+$form["action"]   = "message_template_edit.php";
+$form["db_table"]  = "client_message_template";
+$form["db_table_idx"] = "client_message_template_id";
+$form["db_history"]  = "no";
+$form["tab_default"] = "template";
+$form["list_default"] = "message_template_list.php";
+$form["auth"]   = 'yes';
+
+$form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
+$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
+$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
+$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"]['template'] = array (
+	'title'  => "Settings",
+	'width'  => 100,
+	'template'  => "templates/message_template.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
+		'template_type' => array (
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('welcome' => 'Default welcome email', 'other' => 'Other')
+		),
+		'template_name' => array (
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
+		),
+		'subject' => array (
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
+		),
+		'message' => array (
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXTAREA',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
+		),
+		//#################################
+		// END Datatable fields
+		//#################################
+	)
+);
+
+
+
+?>
diff --git a/interface/web/client/lib/lang/en_client_message_template.lng b/interface/web/client/lib/lang/en_client_message_template.lng
new file mode 100644
index 0000000000000000000000000000000000000000..e2ab2c7970f4bbf4fa96e71911f32c314bbecccc
--- /dev/null
+++ b/interface/web/client/lib/lang/en_client_message_template.lng
@@ -0,0 +1,11 @@
+<?php
+$wb["template_type_txt"] = 'Email type';
+$wb["template_name_txt"] = 'Template name';
+$wb["subject_txt"] = 'Subject';
+$wb["message_txt"] = 'Message';
+$wb['Email template'] = 'Email template';
+$wb['Settings'] = 'Setting';
+$wb['variables_txt'] = 'Variables';
+$wb['variables_description_txt'] = '(The username and password variables are only available in welcome emails.)';
+$wb['duplicate_welcome_error'] = 'There can be only one default welcome email template. Please edit the existing template instead of adding a new one.';
+?>
\ No newline at end of file
diff --git a/interface/web/client/lib/lang/en_client_message_template_list.lng b/interface/web/client/lib/lang/en_client_message_template_list.lng
new file mode 100644
index 0000000000000000000000000000000000000000..7a78bf08dea0f780adb9d22f462cf43e009dc56b
--- /dev/null
+++ b/interface/web/client/lib/lang/en_client_message_template_list.lng
@@ -0,0 +1,5 @@
+<?php
+$wb["list_head_txt"] = 'Email templates';
+$wb["template_type_txt"] = 'Message for';
+$wb["template_name_txt"] = 'Template name';
+?>
\ No newline at end of file
diff --git a/interface/web/client/lib/module.conf.php b/interface/web/client/lib/module.conf.php
index 8b97848b3a5e50eccc259e9387b6ba243cf0b857..e4bddd72f292e8c6738175c9c61d84449a17bf96 100644
--- a/interface/web/client/lib/module.conf.php
+++ b/interface/web/client/lib/module.conf.php
@@ -65,6 +65,10 @@ $items[] = array(   'title'  => "Limit-Templates",
 	'link' => 'client/client_template_list.php',
 	'html_id'   => 'client_template_list');
 
+$items[] = array(   'title'  => "Email-Templates",
+	'target'  => 'content',
+	'link' => 'client/message_template_list.php',
+	'html_id'   => 'message_template_list');
 
 $module["nav"][] = array(   'title' => 'Templates',
 	'open'  => 1,
diff --git a/interface/web/client/list/message_template.list.php b/interface/web/client/list/message_template.list.php
new file mode 100644
index 0000000000000000000000000000000000000000..6441182b91bcfaafa57461cb016fcc774d1fffff
--- /dev/null
+++ b/interface/web/client/list/message_template.list.php
@@ -0,0 +1,77 @@
+<?php
+
+/*
+Copyright (c) 2010, Till Brehm, projektfarm Gmbh
+All rights reserved.
+*/
+
+/*
+	Datatypes:
+	- INTEGER
+	- DOUBLE
+	- CURRENCY
+	- VARCHAR
+	- TEXT
+	- DATE
+*/
+
+
+
+// Name of the list
+$liste["name"]     = "client_message_template";
+
+// Database table
+$liste["table"]    = "client_message_template";
+
+// Index index field of the database table
+$liste["table_idx"]   = "client_message_template_id";
+
+// Search Field Prefix
+$liste["search_prefix"]  = "search_";
+
+// Records per page
+$liste["records_per_page"]  = 15;
+
+// Script File of the list
+$liste["file"]    = "message_template_list.php";
+
+// Script file of the edit form
+$liste["edit_file"]   = "message_template_edit.php";
+
+// Script File of the delete script
+$liste["delete_file"]  = "message_template_del.php";
+
+// Paging Template
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
+
+// Enable authe
+$liste["auth"]    = "yes";
+
+
+/*****************************************************
+* Suchfelder
+*****************************************************/
+
+$liste["item"][] = array( 'field'  => "template_type",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('welcome' => 'Default welcome email', 'other' => 'Other'));
+
+$liste["item"][] = array( 'field'  => "template_name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+
+
+
+?>
diff --git a/interface/web/client/message_template_del.php b/interface/web/client/message_template_del.php
new file mode 100644
index 0000000000000000000000000000000000000000..46aba4f64c3cf21c69669d7d4b51629c0c76311e
--- /dev/null
+++ b/interface/web/client/message_template_del.php
@@ -0,0 +1,58 @@
+<?php
+
+/*
+Copyright (c) 2014 Till Brehm, ISPConfig UG
+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/message_template.list.php";
+$tform_def_file = "form/message_template.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
+
+//* Check permissions for module
+$app->auth->check_module_permissions('client');
+
+$app->uses('tpl,tform');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+}
+
+$page = new page_action;
+$page->onDelete()
+
+?>
diff --git a/interface/web/client/message_template_edit.php b/interface/web/client/message_template_edit.php
new file mode 100644
index 0000000000000000000000000000000000000000..819e267657aab3c753984138b8512f4993d0ef20
--- /dev/null
+++ b/interface/web/client/message_template_edit.php
@@ -0,0 +1,99 @@
+<?php
+/*
+Copyright (c) 2014 Till Brehm, ISPConfig UG
+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/message_template.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
+
+//* Check permissions for module
+$app->auth->check_module_permissions('client');
+
+// Loading classes
+$app->uses('tpl,tform,tform_actions');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+	
+	function onSubmit() {
+		global $app, $conf;
+		
+		// Check for duplicates
+		if($this->dataRecord['template_type'] == 'welcome') {
+			$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
+			$sql = "SELECT count(client_message_template_id) as number FROM client_message_template WHERE template_type = 'welcome' AND sys_groupid = ".$client_group_id;
+			if($this->id > 0) {
+				$sql .= " AND client_message_template_id != ".$this->id;
+			}
+			
+			$tmp = $app->db->queryOneRecord($sql);
+			if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng('duplicate_welcome_error');
+		}
+		
+		parent::onSubmit();
+	}
+	
+	function onShowEnd() {
+		global $app, $conf;
+	
+		//message variables
+		$message_variables = '';
+		$sql = "SHOW COLUMNS FROM client WHERE Field NOT IN ('client_id', 'sys_userid', 'sys_groupid', 'sys_perm_user', 'sys_perm_group', 'sys_perm_other', 'parent_client_id', 'id_rsa', 'ssh_rsa', 'created_at', 'default_mailserver', 'default_webserver', 'web_php_options', 'ssh_chroot', 'default_dnsserver', 'default_dbserver', 'template_master', 'template_additional', 'force_suexec', 'default_slave_dnsserver', 'usertheme', 'locked', 'canceled', 'can_use_api', 'tmp_data', 'customer_no_template', 'customer_no_start', 'customer_no_counter', 'added_date', 'added_by') AND Field NOT LIKE 'limit_%'";
+		$field_names = $app->db->queryAllRecords($sql);
+		if(!empty($field_names) && is_array($field_names)){
+			foreach($field_names as $field_name){
+				if($field_name['Field'] != ''){
+					if($field_name['Field'] == 'gender'){
+						$message_variables .= '<a href="javascript:void(0);" class="addPlaceholder">{salutation}</a> ';
+					} else {
+						$message_variables .= '<a href="javascript:void(0);" class="addPlaceholder">{'.$field_name['Field'].'}</a> ';
+					}
+				}
+			}
+		}
+		$app->tpl->setVar('message_variables', trim($message_variables));
+
+		parent::onShowEnd();
+	}
+	
+}
+
+$page = new page_action;
+$page->onLoad();
+
+?>
diff --git a/interface/web/client/message_template_list.php b/interface/web/client/message_template_list.php
new file mode 100644
index 0000000000000000000000000000000000000000..a324732ed0a236803d1fa05cbb2951399b71f99e
--- /dev/null
+++ b/interface/web/client/message_template_list.php
@@ -0,0 +1,53 @@
+<?php
+/*
+Copyright (c) 2014 Till Brehm, ISPConfig UG
+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.
+*/
+
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$list_def_file = "list/message_template.list.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+//* Check permissions for module
+$app->auth->check_module_permissions('client');
+
+$app->uses('listform_actions');
+
+//$app->listform_actions->SQLOrderBy = 'ORDER BY company_name, contact_name, client_id';
+//$app->listform_actions->SQLExtWhere = "limit_client = 0";
+$app->listform_actions->onLoad();
+
+
+?>
diff --git a/interface/web/client/reseller_edit.php b/interface/web/client/reseller_edit.php
index c8868da5aca585f6322c1f727bd5aa91574ae007..4a7cc874077c524334e7438585536e9d8c9c75d1 100644
--- a/interface/web/client/reseller_edit.php
+++ b/interface/web/client/reseller_edit.php
@@ -266,6 +266,47 @@ class page_action extends tform_actions {
 				
 			}
 		}
+		
+		//* Send welcome email
+		$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
+		$sql = "SELECT * FROM client_message_template WHERE template_type = 'welcome' AND sys_groupid = ".$client_group_id;
+		$email_template = $app->db->queryOneRecord($sql);
+		$client = $app->tform->getDataRecord($this->id);
+
+		if(is_array($email_template) && $client['email'] != '') {
+			//* Parse client details into message
+			$message = $email_template['message'];
+			$subject = $email_template['subject'];
+			foreach($client as $key => $val) {
+				switch ($key) {
+				case 'password':
+					$message = str_replace('{password}', $this->dataRecord['password'], $message);
+					$subject = str_replace('{password}', $this->dataRecord['password'], $subject);
+					break;
+				case 'gender':
+					$message = str_replace('{salutation}', $wb['gender_'.$val.'_txt'], $message);
+					$subject = str_replace('{salutation}', $wb['gender_'.$val.'_txt'], $subject);
+					break;
+				default:
+					$message = str_replace('{'.$key.'}', $val, $message);
+					$subject = str_replace('{'.$key.'}', $val, $subject);
+				}
+			}
+			
+			//* Get sender address
+			if($app->auth->is_admin()) {
+				$app->uses('getconf');
+				$system_config = $app->getconf->get_global_config();
+				$from = $system_config['admin_mail'];
+			} else {
+				$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
+				$reseller = $app->db->queryOneRecord("SELECT client.email FROM sys_group,client WHERE client.client_id = sys_group.client_id and sys_group.groupid = ".$client_group_id);
+				$from = $reseller["email"];
+			}
+
+			//* Send the email
+			$app->functions->mail($client['email'], $subject, $message, $from);
+		}
 
 		parent::onAfterInsert();
 	}
diff --git a/interface/web/client/templates/client_message_template_list.htm b/interface/web/client/templates/client_message_template_list.htm
new file mode 100644
index 0000000000000000000000000000000000000000..95f6f00bd0c1c11021dfa56f79c4b42cb50f02fe
--- /dev/null
+++ b/interface/web/client/templates/client_message_template_list.htm
@@ -0,0 +1,57 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+
+<div class="panel panel_list_client_message_template">
+
+  <div class="pnl_toolsarea">
+    <fieldset><legend>{tmpl_var name="toolsarea_head_txt"}</legend>
+      <div class="buttons">
+        <button class="iconstxt icoAdd" type="button" onclick="loadContent('client/message_template_edit.php');">
+          <span>{tmpl_var name="add_new_record_txt"}</span>
+        </button>
+      </div>
+    </fieldset>
+  </div>
+
+  <div class="pnl_listarea">
+    <fieldset><legend><tmpl_var name="list_head_txt"></legend>
+      <table class="list">
+        <thead>
+          <tr>
+            <th class="tbl_col_template_type" scope="col"><tmpl_var name="template_type_txt"></th>
+            <th class="tbl_col_template_name" scope="col"><tmpl_var name="template_name_txt"></th>
+            <th class="tbl_col_buttons" scope="col">&nbsp;</th>
+          </tr>
+          <tr>
+            <td class="tbl_col_template_type"><select name="search_template_type" onChange="submitForm('pageForm','client/message_template_list.php');">{tmpl_var name='search_template_type'}</select></td>
+            <td class="tbl_col_template_name"><input type="text" name="search_template_name" value="{tmpl_var name='search_template_name'}" /></td>
+            <td class="tbl_col_buttons"><div class="buttons"><button type="button" class="icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onclick="submitForm('pageForm','client/message_template_list.php');"><span>{tmpl_var name="filter_txt"}</span></button></div></td>
+          </tr>
+        </thead>
+        <tbody>
+          <tmpl_loop name="records">
+          <tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
+            <td class="tbl_col_template_type"><a href="#" onclick="loadContent('client/message_template_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="template_type"}</a></td>
+            <td class="tbl_col_template_name"><a href="#" onclick="loadContent('client/message_template_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="template_name"}</a></td>
+            <td class="tbl_col_buttons">
+              <div class="buttons icons16">
+                <a class="button icons16 icoDelete" href="javascript: del_record('client/message_template_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span>{tmpl_var name='delete_txt'}</span></a>
+              </div>
+            </td>
+          </tr>
+          </tmpl_loop>
+          <tmpl_unless name="records">
+              <tr class="tbl_row_noresults tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
+                  <td colspan="2">{tmpl_var name='globalsearch_noresults_text_txt'}</td>
+              </tr>
+          </tmpl_unless>
+        </tbody>
+        <tfoot>
+          <tr>
+            <td class="tbl_footer tbl_paging" colspan="3"><tmpl_var name="paging"></td>
+          </tr>
+        </tfoot>
+      </table>
+    </fieldset>
+  </div>
+
+</div>
diff --git a/interface/web/client/templates/message_template.htm b/interface/web/client/templates/message_template.htm
new file mode 100644
index 0000000000000000000000000000000000000000..4c0c6231623c2180028c877a2534c5f2b92fc64f
--- /dev/null
+++ b/interface/web/client/templates/message_template.htm
@@ -0,0 +1,39 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+<p><tmpl_var name="list_desc_txt"></p>
+
+<div class="panel panel_invoice_message_template">
+
+  <div class="pnl_formsarea">
+    <fieldset class="inlineLabels"><legend>Settings</legend>
+      <div class="ctrlHolder">
+      	<label for="template_type">{tmpl_var name='template_type_txt'}</label>
+        <select name="template_type" id="template_type" class="selectInput">
+					{tmpl_var name='template_type'}
+				</select>
+      </div>
+      <div class="ctrlHolder">
+      	<label for="template_name">{tmpl_var name='template_name_txt'}</label>
+        <input name="template_name" id="template_name" value="{tmpl_var name='template_name'}" size="30" maxlength="255" type="text" class="textInput" />
+			</div>
+      <div class="ctrlHolder">
+      	<label for="subject">{tmpl_var name='subject_txt'}</label>
+        <input name="subject" id="subject" value="{tmpl_var name='subject'}" style="width:500px" size="30" maxlength="255" type="text" class="textInput" />
+		<br clear="all">{tmpl_var name='variables_txt'}: {tmpl_var name="message_variables"} <br />{tmpl_var name='variables_description_txt'}
+			</div>
+      <div class="ctrlHolder">
+      	<label for="message">{tmpl_var name='message_txt'}</label>
+        <textarea name="message" id="message" rows='' cols='' style="width:500px">{tmpl_var name='message'}</textarea>
+		<br clear="all">{tmpl_var name='variables_txt'}: {tmpl_var name="message_variables"} <br />{tmpl_var name='variables_description_txt'}
+      </div>
+	  <div class="buttonHolder buttons">
+      <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','client/message_template_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
+      <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('client/message_template_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
+    </div>
+    </fieldset>
+
+    <input type="hidden" name="id" value="{tmpl_var name='id'}">
+
+    
+  </div>
+  
+</div>
diff --git a/interface/web/client/templates/message_template_list.htm b/interface/web/client/templates/message_template_list.htm
new file mode 100644
index 0000000000000000000000000000000000000000..27b0113df4d68d30d2675ca3f43a0ce0c3b5d088
--- /dev/null
+++ b/interface/web/client/templates/message_template_list.htm
@@ -0,0 +1,52 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+
+<div class="panel panel_list_invoice_message_template">
+
+  <div class="pnl_toolsarea">
+    <fieldset><legend>{tmpl_var name="toolsarea_head_txt"}</legend>
+      <div class="buttons">
+        <button class="iconstxt icoAdd" type="button" onClick="loadContent('billing/invoice_message_template_edit.php');">
+          <span>{tmpl_var name="add_new_record_txt"}</span>
+        </button>
+      </div>
+    </fieldset>
+  </div>
+
+  <div class="pnl_listarea">
+    <fieldset><legend><tmpl_var name="list_head_txt"></legend>
+      <table class="list">
+        <thead>
+          <tr>
+            <th class="tbl_col_template_type" scope="col"><tmpl_var name="template_type_txt"></th>
+            <th class="tbl_col_template_name" scope="col"><tmpl_var name="template_name_txt"></th>
+            <th class="tbl_col_buttons" scope="col">&nbsp;</th>
+          </tr>
+          <tr>
+            <td class="tbl_col_template_type"><select name="search_template_type" onChange="submitForm('pageForm','billing/invoice_message_template_list.php');">{tmpl_var name='search_template_type'}</select></td>
+            <td class="tbl_col_template_name"><input type="text" name="search_template_name" value="{tmpl_var name='search_template_name'}" /></td>
+            <td class="tbl_col_buttons"><div class="buttons"><button type="button" class="icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onClick="submitForm('pageForm','billing/invoice_message_template_list.php');"><span>{tmpl_var name="filter_txt"}</span></button></div></td>
+          </tr>
+        </thead>
+        <tbody>
+          <tmpl_loop name="records">
+          <tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
+            <td class="tbl_col_template_type"><a href="#" onClick="loadContent('billing/invoice_message_template_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="template_type"}</a></td>
+            <td class="tbl_col_template_name"><a href="#" onClick="loadContent('billing/invoice_message_template_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="template_name"}</a></td>
+            <td class="tbl_col_buttons">
+              <div class="buttons icons16">    
+                <a class="button icons16 icoDelete" href="javascript: del_record('billing/invoice_message_template_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span>{tmpl_var name='delete_txt'}</span></a>
+              </div>
+            </td>
+          </tr>
+          </tmpl_loop>
+        </tbody>
+        <tfoot>
+          <tr>
+            <td class="tbl_footer tbl_paging" colspan="3"><tmpl_var name="paging"></td>
+          </tr>
+        </tfoot>
+      </table>
+    </fieldset>
+  </div>
+
+</div>