diff --git a/plugins/mass_mailouts/actions/mass_mailouts/progressWindow.php b/plugins/mass_mailouts/actions/mass_mailouts/progressWindow.php
new file mode 100644
index 0000000000000000000000000000000000000000..b523ddba8f91ebf9af4e356a9ad17fc6a368b2d9
--- /dev/null
+++ b/plugins/mass_mailouts/actions/mass_mailouts/progressWindow.php
@@ -0,0 +1,72 @@
+<?php 
+global $CONFIG;
+global $SESSION;
+action_gatekeeper();
+admin_gatekeeper();
+
+$email_subject = urldecode(get_input("email_subject"));
+$email_text = urldecode(get_input("email_text"));
+$recipients = urldecode(get_input("recipients"));
+
+if(!empty($email_subject) && !empty($email_text)){
+	$formBody = elgg_view("input/hidden", array("internalname" => "email_subject", "value" => $email_subject));
+	$formBody .= elgg_view("input/hidden", array("internalname" => "email_text", "value" => $email_text));
+	$formBody .= elgg_view("input/hidden", array("internalname" => "recipients", "value" => $recipients));
+	
+	$form = elgg_view("input/form", array("internalid" => "massmailForm", "action" => $CONFIG->wwwroot . "action/mass_mailouts/send", "body" => $formBody));
+} else {
+	$close = "<script type='text/javascript'>window.close();</script>";
+	echo $close;
+}
+
+?>
+<script type="text/javascript" src="<?php echo $CONFIG->wwwroot; ?>vendors/jquery/jquery-1.3.2.min.js"></script>
+<script type="text/javascript" src="<?php echo $CONFIG->wwwroot; ?>mod/mass_mailouts/js/jquery.progressbar.js"></script>
+<script type='text/javascript'>
+	$(document).ready(function(){
+		$('#massmailForm').submit(function(){
+			$.post(this.action, $('#' + this.id).serialize(), function(data){
+				// do nothing
+			});
+
+			setTimeout("checkProgress()", 1000);
+			
+			return false;
+		});
+
+		$('#massmailForm').submit();
+	});
+
+	function checkProgress(){
+		$.post("<?php echo $CONFIG->wwwroot; ?>pg/mass_mailouts/progress", { is_action: "yes" }, function(data){
+			if(data){
+				var progress = data.split("|"); 
+				$('#progress').progressBar(progress[0], { showText: false, boxImage: '<?php echo $CONFIG->wwwroot; ?>/mod/mass_mailouts/images/progressbar.gif', barImage: '<?php echo $CONFIG->wwwroot; ?>/mod/mass_mailouts/images/progressbg_green.gif'});
+				$('#progressText').html(progress[1]);
+				
+				if(parseInt(progress[0]) >= 100){
+					setTimeout("window.close()", 10000);
+				}else {
+					setTimeout("checkProgress()", 1000);
+				}
+			}
+		});
+		
+	}
+</script>
+<div id='all'>
+	<center>
+	<div id='sending'>
+		<img src="<?php echo $CONFIG->wwwroot; ?>_graphics/ajax_loader.gif" alt="sending" title="sending" />
+		<br />
+		<br />
+	</div>
+	<div id="progress"></div>
+	<div id="progressText"></div>
+	<div id="form" style="display:none;">
+		<?php echo $form;
+		ob_flush(); //this is needed to ensure that headers are already sent to avoid the progress page redirecting
+		?>
+	</div>
+	</center>
+</div>
\ No newline at end of file
diff --git a/plugins/mass_mailouts/actions/mass_mailouts/send.php b/plugins/mass_mailouts/actions/mass_mailouts/send.php
new file mode 100644
index 0000000000000000000000000000000000000000..1b49d99062078eaaa71c46c5555c0ad5a69080b5
--- /dev/null
+++ b/plugins/mass_mailouts/actions/mass_mailouts/send.php
@@ -0,0 +1,93 @@
+<?php
+/**
+* Mass Mail outs.
+* 
+* @package mass_mailouts
+* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+* @author ColdTrick IT Solutions
+* @copyright ColdTrick 2009
+* @link http://www.coldtrick.com/
+*/
+
+global $CONFIG;
+
+action_gatekeeper();
+admin_gatekeeper();
+
+$subject = get_input('email_subject');
+$text = get_input("email_text");
+$recipients = get_input("recipients");
+$type = substr($recipients, 0, 1);
+$id = substr($recipients, 1); 
+
+if (!empty($subject) && !empty($text)) {
+	switch($type) {
+		case "t": //all
+			$count = get_entities("user", "", 0, "", 0, 0, true);
+			$users = get_entities("user", "", 0, "", $count);
+			break;
+		case "c": //friends
+			$users = get_entities_from_relationship('friend', get_loggedin_userid(), $inverse_relationship, 'user', $subtype, $owner_guid, "", 10, 0);
+			$count = count($users);
+			break;
+		case "g": //groups
+			$users = get_group_members($id,200, 0, 0 , false);
+			$count = count($users);
+			break;
+		case "l": //list of friends
+			$users = get_members_of_access_collection($id, false);
+			$count = count($users);
+			break;
+		default:
+			$users = array();
+			register_error(elgg_echo("mass_mailouts:failure"));
+			break;
+	}
+	
+	$failure = 0;
+	$succes = 0;
+	
+	$curUser = get_loggedin_user();
+	remove_metadata($curUser->guid, "mass_mailouts_progress");
+	
+	foreach($users as $user){
+		set_time_limit(5);
+		
+		$newSubject = str_ireplace("[displayname]", $user->name, $subject);
+		$newSubject = str_ireplace("[profile]", "<a href='" . $user->getUrl() . "'>" . $user->getUrl() . "</a>", $newSubject);
+		$newSubject = str_ireplace("[username]", $user->username, $newSubject);
+		$newSubject = str_ireplace("[email]", $user->email, $newSubject);
+		$newSubject = str_ireplace("&nbsp;", "", $newSubject);
+		
+		$newText = str_ireplace("[displayname]", $user->name, $text);
+		$newText = str_ireplace("[profile]", "<a href='" . $user->getUrl() . "'>" . $user->getUrl() . "</a>", $newText);
+		$newText = str_ireplace("[username]", $user->username, $newText);
+		$newText = str_ireplace("[email]", $user->email, $newText);
+		$newText = str_ireplace("&nbsp;", "", $newText);
+		
+		$result = notify_user($user->guid, $user->site_guid, $newSubject, $newText, null, "email");
+		
+		if($result["email"] === false){
+			$failure++;
+		} else {
+			$succes++;
+		}
+		
+		$curUser->mass_mailouts_progress = ((($succes + $failure) / $count) * 100) . "|" . sprintf(elgg_echo("mass_mailouts:progress:text"), ($succes + $failure), $count);
+	}
+	
+	if($failure == 0){
+		system_message(sprintf(elgg_echo("mass_mailouts:success"), $succes));
+	} else {
+		if($failure == $count){
+			register_error(elgg_echo("mass_mailouts:failure"));
+		} else {
+			register_error(sprintf(elgg_echo("mass_mailouts:some_errors"), $failure, $count));
+		}
+	}
+} else {
+	register_error(elgg_echo("mass_mailouts:invalid_input"));
+}
+
+forward($_SERVER["HTTP_REFERER"]);
+?>
\ No newline at end of file
diff --git a/plugins/mass_mailouts/images/progressbar.gif b/plugins/mass_mailouts/images/progressbar.gif
new file mode 100644
index 0000000000000000000000000000000000000000..abe588c15c4eda53bcecc0ab00434c925cb1b45f
Binary files /dev/null and b/plugins/mass_mailouts/images/progressbar.gif differ
diff --git a/plugins/mass_mailouts/images/progressbg_black.gif b/plugins/mass_mailouts/images/progressbg_black.gif
new file mode 100644
index 0000000000000000000000000000000000000000..74fd1f9b3e052e2ca18058526c39f6eaef580cba
Binary files /dev/null and b/plugins/mass_mailouts/images/progressbg_black.gif differ
diff --git a/plugins/mass_mailouts/images/progressbg_green.gif b/plugins/mass_mailouts/images/progressbg_green.gif
new file mode 100644
index 0000000000000000000000000000000000000000..f3f3bf681141982dc72429b21b4c8af7dbfd2b70
Binary files /dev/null and b/plugins/mass_mailouts/images/progressbg_green.gif differ
diff --git a/plugins/mass_mailouts/images/progressbg_orange.gif b/plugins/mass_mailouts/images/progressbg_orange.gif
new file mode 100644
index 0000000000000000000000000000000000000000..808cac7cfbcdaea93fa42d1c5de30ee9a0b060a5
Binary files /dev/null and b/plugins/mass_mailouts/images/progressbg_orange.gif differ
diff --git a/plugins/mass_mailouts/images/progressbg_red.gif b/plugins/mass_mailouts/images/progressbg_red.gif
new file mode 100644
index 0000000000000000000000000000000000000000..54dfa135f0e82934190141f2c991817dd616a2e3
Binary files /dev/null and b/plugins/mass_mailouts/images/progressbg_red.gif differ
diff --git a/plugins/mass_mailouts/images/progressbg_yellow.gif b/plugins/mass_mailouts/images/progressbg_yellow.gif
new file mode 100644
index 0000000000000000000000000000000000000000..fdb0dfc981cbbfbca4e80f4ff5ccfac247b3be91
Binary files /dev/null and b/plugins/mass_mailouts/images/progressbg_yellow.gif differ
diff --git a/plugins/mass_mailouts/index.php b/plugins/mass_mailouts/index.php
new file mode 100644
index 0000000000000000000000000000000000000000..2850b4fea563d46d2e091fde152d87c4171fff63
--- /dev/null
+++ b/plugins/mass_mailouts/index.php
@@ -0,0 +1,28 @@
+<?php
+/**
+* Mass Mail outs.
+* 
+* @package mass_mailouts
+* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+* @author ColdTrick IT Solutions
+* @copyright ColdTrick 2009
+* @link http://www.coldtrick.com/
+*/
+
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+admin_gatekeeper();
+set_context('admin');
+
+// Set admin user for user block
+set_page_owner($_SESSION['guid']);
+
+$title = elgg_view_title(elgg_echo('mass_mailouts'));
+$form = elgg_view('mass_mailouts/form');
+
+$page_data = $title . $form;
+
+// Display main admin menu
+page_draw(elgg_echo('mass_mailouts'), elgg_view_layout("two_column_left_sidebar", '', $page_data));
+
+?>
diff --git a/plugins/mass_mailouts/js/jquery.progressbar.js b/plugins/mass_mailouts/js/jquery.progressbar.js
new file mode 100644
index 0000000000000000000000000000000000000000..912af4ac73c31ee2e69a3c308b1472f41443ca35
--- /dev/null
+++ b/plugins/mass_mailouts/js/jquery.progressbar.js
@@ -0,0 +1,144 @@
+/*
+ * jQuery Progress Bar plugin
+ * Version 1.1.0 (06/20/2008)
+ * @requires jQuery v1.2.1 or later
+ *
+ * Copyright (c) 2008 Gary Teo
+ * http://t.wits.sg
+
+USAGE:
+	$(".someclass").progressBar();
+	$("#progressbar").progressBar();
+	$("#progressbar").progressBar(45);							// percentage
+	$("#progressbar").progressBar({showText: false });			// percentage with config
+	$("#progressbar").progressBar(45, {showText: false });		// percentage with config
+*/
+(function($) {
+	$.extend({
+		progressBar: new function() {
+
+			this.defaults = {
+				increment	: 2,
+				speed		: 15,
+				showText	: true,											// show text with percentage in next to the progressbar? - default : true
+				width		: 120,											// Width of the progressbar - don't forget to adjust your image too!!!
+				boxImage	: 'images/progressbar.gif',						// boxImage : image around the progress bar
+				barImage	: {
+								0:	'images/progressbg_red.gif',
+								30: 'images/progressbg_orange.gif',
+								70: 'images/progressbg_green.gif'
+							},												// Image to use in the progressbar. Can be a single image too: 'images/progressbg_green.gif'
+				height		: 12											// Height of the progressbar - don't forget to adjust your image too!!!
+			};
+			
+			/* public methods */
+			this.construct = function(arg1, arg2) {
+				var argpercentage	= null;
+				var argconfig		= null;
+				
+				if (arg1 != null) {
+					if (!isNaN(arg1)) {
+						argpercentage 	= arg1;
+						if (arg2 != null) {
+							argconfig	= arg2; }
+					} else {
+						argconfig		= arg1; 
+					}
+				}
+				
+				return this.each(function(child) {
+					var pb		= this;
+					if (argpercentage != null && this.bar != null && this.config != null) {
+						this.config.tpercentage	= argpercentage;
+						if (argconfig != null)
+							pb.config			= $.extend(this.config, argconfig);
+					} else {
+						var $this				= $(this);
+						var config				= $.extend({}, $.progressBar.defaults, argconfig);
+						var percentage			= argpercentage;
+						if (argpercentage == null)
+							var percentage		= $this.html().replace("%","");	// parsed percentage
+						
+						
+						$this.html("");
+						var bar					= document.createElement('img');
+						var text				= document.createElement('span');
+						bar.id 					= this.id + "_percentImage";
+						text.id 				= this.id + "_percentText";
+						bar.title				= percentage + "%";
+						bar.alt					= percentage + "%";
+						bar.src					= config.boxImage;
+						bar.width				= config.width;
+						var $bar				= $(bar);
+						var $text				= $(text);
+						
+						this.bar				= $bar;
+						this.ntext				= $text;
+						this.config				= config;
+						this.config.cpercentage	= 0;
+						this.config.tpercentage	= percentage;
+						
+						$bar.css("width", config.width + "px");
+						$bar.css("height", config.height + "px");
+						$bar.css("background-image", "url(" + getBarImage(this.config.cpercentage, config) + ")");
+						$bar.css("padding", "0");
+						$bar.css("margin", "0");
+						$this.append($bar);
+						$this.append($text);
+					}
+					
+					function getBarImage (percentage, config) {
+						var image = config.barImage;
+						if (typeof(config.barImage) == 'object') {
+							for (var i in config.barImage) {
+								if (percentage >= parseInt(i)) {
+									image = config.barImage[i];
+								} else { break; }
+							}
+						}
+						return image;
+					}
+					
+					var t = setInterval(function() {
+						var config		= pb.config;
+						var cpercentage = parseInt(config.cpercentage);
+						var tpercentage = parseInt(config.tpercentage);
+						var increment	= parseInt(config.increment);
+						var bar			= pb.bar;
+						var text		= pb.ntext;
+						var pixels		= config.width / 100;			// Define how many pixels go into 1%
+						
+						bar.css("background-image", "url(" + getBarImage(cpercentage, config) + ")");
+						bar.css("background-position", (((config.width * -1)) + (cpercentage * pixels)) + 'px 50%');
+						
+						if (config.showText)
+							text.html(" " + Math.round(cpercentage) + "%");
+						
+						if (cpercentage > tpercentage) {
+							if (cpercentage - increment  < tpercentage) {
+								pb.config.cpercentage = 0 + tpercentage
+							} else {
+								pb.config.cpercentage -= increment;
+							}
+						}
+						else if (pb.config.cpercentage < pb.config.tpercentage) {
+							if (cpercentage + increment  > tpercentage) {
+								pb.config.cpercentage = tpercentage
+							} else {
+								pb.config.cpercentage += increment;
+							}
+						} 
+						else {
+							clearInterval(t);
+						}
+					}, pb.config.speed); 
+				});
+			};
+		}
+	});
+		
+	$.fn.extend({
+        progressBar: $.progressBar.construct
+	});
+	
+})(jQuery);
\ No newline at end of file
diff --git a/plugins/mass_mailouts/languages/en.php b/plugins/mass_mailouts/languages/en.php
new file mode 100644
index 0000000000000000000000000000000000000000..72c3bc576e658cc65f5396a69b34ddef90a47306
--- /dev/null
+++ b/plugins/mass_mailouts/languages/en.php
@@ -0,0 +1,37 @@
+<?php
+	/**
+	 * Mass Mail outs.
+	 * 
+	 * @package mass_mailouts
+	 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+	 * @author ColdTrick IT Solutions
+	 * @copyright ColdTrick 2009
+	 * @link http://www.coldtrick.com/
+	 */
+
+	$english = array(
+		/**
+		 * Menu items and titles
+		 */
+		'mass_mailouts' => 'Mass Mailouts',
+		'mass_mailouts:email_text' => 'E-mail Message:',
+		'mass_mailouts:subject' => 'E-mail Subject:',
+		'mass_mailouts:recipienttype' => 'Recipients:',
+		'mass_mailouts:send' => 'Send E-mail',
+		'mass_mailouts:footnote' => "You can use the following tags to personalize the emails (can be used is Subject and in Text):",
+		'mass_mailouts:footnote:displayname' => "for the user's full name (display name)",
+		'mass_mailouts:footnote:profile' => "for the link to the user's Profile page",
+		'mass_mailouts:footnote:username' => "for the user's username",
+		'mass_mailouts:footnote:email' => "for the user's e-mail address",
+		
+		'mass_mailouts:invalid_input' => "Incorrect input provided, you need a Subject and some Text",
+		'mass_mailouts:success' => 'E-mail has been sent succesfully to %s users',
+		'mass_mailouts:some_errors' => 'E-mail failed to be send to some of the users (failure: %s / succes: %s)',
+		'mass_mailouts:failure' => 'E-mail failed to be send',
+		
+		'mass_mailouts:progress:text' => "Send %s of %s",
+		'mass_mailouts:progress:window_title' => "Mass Mailouts progress",
+	);
+	
+	add_translation("en", $english);
+?>
\ No newline at end of file
diff --git a/plugins/mass_mailouts/languages/nl.php b/plugins/mass_mailouts/languages/nl.php
new file mode 100644
index 0000000000000000000000000000000000000000..26bc633afb0eb4604a7a128561dcc0aa9a0d64f2
--- /dev/null
+++ b/plugins/mass_mailouts/languages/nl.php
@@ -0,0 +1,36 @@
+<?php
+	/**
+	 * Mass Mail outs.
+	 * 
+	 * @package mass_mailouts
+	 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+	 * @author ColdTrick IT Solutions
+	 * @copyright ColdTrick 2009
+	 * @link http://www.coldtrick.com/
+	 */
+
+	$dutch = array(
+		/**
+		 * Menu items and titles
+		 */
+		'mass_mailouts' => 'Mass Mailouts',
+		'mass_mailouts:email_text' => 'E-mail Bericht:',
+		'mass_mailouts:subject' => 'E-mail Onderwerp:',
+		'mass_mailouts:send' => 'Verstuur E-mail',
+		'mass_mailouts:footnote' => "Je kunt de volgende tags gebruiken om de e-mails te personalizeren (kan worden gebruikt in Onderwerp en Tekst):",
+		'mass_mailouts:footnote:displayname' => "voor de volledige naam van de gebruiker (weergave naam)",
+		'mass_mailouts:footnote:profile' => "voor de link naar het profiel van de gebruiker",
+		'mass_mailouts:footnote:username' => "voor de gebruikernaam",
+		'mass_mailouts:footnote:email' => "voor het e-mailadres van de gebruiker",
+		
+		'mass_mailouts:invalid_input' => "Onjuiste invoer, je moet een Onderwerp en Text opgeven",
+		'mass_mailouts:success' => 'E-mail is succesvol verstuurd aan %s gebruikers',
+		'mass_mailouts:some_errors' => 'E-mail is niet aan alle gebruikers verstuurd (fouten: %s / succes: %s)',
+		'mass_mailouts:failure' => 'E-mail is niet verstuurd',
+		
+		'mass_mailouts:progress:text' => "%s van %s verzonden",
+		'mass_mailouts:progress:window_title' => "Mass Mailouts voortgang",
+	);
+	
+	add_translation("nl", $dutch);
+?>
\ No newline at end of file
diff --git a/plugins/mass_mailouts/manifest.xml b/plugins/mass_mailouts/manifest.xml
new file mode 100644
index 0000000000000000000000000000000000000000..d4f15879dc60de301eae5e2ef900080cdc65d0df
--- /dev/null
+++ b/plugins/mass_mailouts/manifest.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin_manifest>
+	<field key="author" value="ColdTrick IT Solutions" />
+	<field key="version" value="1.4" />
+	<field key="description" value="Improved Mass_mail from Brucepro improved again by Adam. Send Email to different user groups" />
+	<field key="website" value="http://www.coldtrick.com/" />
+	<field key="copyright" value="(C) ColdTrick 2009" />
+	<field key="licence" value="GNU Public License version 2" />
+	<field key="elgg_version" value="2009072201" />
+</plugin_manifest>
diff --git a/plugins/mass_mailouts/progress.php b/plugins/mass_mailouts/progress.php
new file mode 100644
index 0000000000000000000000000000000000000000..dbaf8859a4118c8f158b9cea9e1e367f563563b2
--- /dev/null
+++ b/plugins/mass_mailouts/progress.php
@@ -0,0 +1,20 @@
+<?php 
+
+global $CONFIG;
+
+admin_gatekeeper();
+
+$user = get_user(get_loggedin_userid());
+
+if(!empty($user)){
+	$progress = $user->mass_mailouts_progress;
+	if(!empty($progress)){
+		echo $progress;
+	} else {
+		echo 0;
+	}
+} else {
+	echo 0;
+}
+
+?>
\ No newline at end of file
diff --git a/plugins/mass_mailouts/start.php b/plugins/mass_mailouts/start.php
new file mode 100644
index 0000000000000000000000000000000000000000..9c9d53066862014e267c3878ff52950148d07981
--- /dev/null
+++ b/plugins/mass_mailouts/start.php
@@ -0,0 +1,61 @@
+<?php
+	/**
+	 * Mass Mail outs.
+	 * 
+	 * @package mass_mailouts
+	 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+	 * @author ColdTrick IT Solutions
+	 * @copyright ColdTrick 2009
+	 * @link http://www.coldtrick.com/
+	 */
+	global $CONFIG;
+	
+	/**
+	 * Initialise and set up the menus.
+	 *
+	 */
+	function mass_mailouts_init(){
+		// Extend CSS
+		extend_view("css", "mass_mailouts/css");
+		
+		// Register a page handler, so we can have nice URLs
+		register_page_handler('mass_mailouts','mass_mailouts_page_handler');
+	}
+	
+	/**
+	 * Adding to the admin menu
+	 *
+	 */
+	function mass_mailouts_pagesetup(){
+		if (get_context() == 'admin' && isadminloggedin()) {
+			global $CONFIG;
+			add_submenu_item(elgg_echo('mass_mailouts'), $CONFIG->wwwroot . 'pg/mass_mailouts/');
+		}
+	}
+	
+	/**
+	 * page handler
+	 *
+	 * @param array $page Array of page elements, forwarded by the page handling mechanism
+	 */
+	function mass_mailouts_page_handler($page) {
+		global $CONFIG;
+		switch ($page[0]) {
+			case "progress":
+				include($CONFIG->pluginspath . "mass_mailouts/progress.php");
+				break;
+			default:
+				include($CONFIG->pluginspath . "mass_mailouts/index.php");
+				break;
+		}
+	}
+	
+	// Initialise log browser
+	register_elgg_event_handler('init','system','mass_mailouts_init');
+	register_elgg_event_handler('pagesetup','system','mass_mailouts_pagesetup');
+	
+	// Register Action
+	register_action("mass_mailouts/send", false, $CONFIG->pluginspath . "mass_mailouts/actions/mass_mailouts/send.php", true);
+	register_action("mass_mailouts/progressWindow", false, $CONFIG->pluginspath . "mass_mailouts/actions/mass_mailouts/progressWindow.php", true);
+	register_action("mass_mailouts/progress", false, $CONFIG->pluginspath . "mass_mailouts/actions/mass_mailouts/progress.php", true);
+?>
\ No newline at end of file
diff --git a/plugins/mass_mailouts/version.txt b/plugins/mass_mailouts/version.txt
new file mode 100644
index 0000000000000000000000000000000000000000..62189105978db0e0937fe9ad201645c3d860caec
--- /dev/null
+++ b/plugins/mass_mailouts/version.txt
@@ -0,0 +1,36 @@
+Plugin: Mass Mailouts
+Author: ColdTrick IT Solutions and others
+Copyrights: 2009 ColdTrick, Alan, Adam
+
+====================================================================
+Version History:
+1.4:
+- Sending to different sub-groups
+- Works on slowers servers
+- Works with TinyMCE (formatting is lost)
+
+1.3:
+- Sending now from a new window
+- Sending progress indicator
+- Small translation changes
+
+1.1.1:
+- Fixed test setup in send.php (thanks Johno)
+
+1.1:
+- Fixed text error in translation file ([profile] instead of [profilepage])
+- Cleaned up the text to be send some further
+
+1.0:
+- First version based on original work from Brucepro
+- Redid some coding for cleanup
+- Now using Elgg mailfunction, not is own
+
+====================================================================
+TO DO:
+- Send mail using cron
+- Add admin option to choose with mail methode
+
+====================================================================
+Known Issue:
+- Slow with many users
diff --git a/plugins/mass_mailouts/views/default/input/recipienttype.php b/plugins/mass_mailouts/views/default/input/recipienttype.php
new file mode 100644
index 0000000000000000000000000000000000000000..98e09bc6a11bd7bc542fb2afd5221e1f34f630a8
--- /dev/null
+++ b/plugins/mass_mailouts/views/default/input/recipienttype.php
@@ -0,0 +1,25 @@
+<?php
+	$groupquery = "SELECT guid,name from {$CONFIG->dbprefix}groups_entity";
+	$groupdata = get_data($groupquery);
+	$userid = get_loggedin_userid();
+	$listquery = "select id,name from {$CONFIG->dbprefix}access_collections where owner_guid = $userid";
+	$listdata = get_data($listquery);
+?>
+<select name="recipients" size="auto">
+<?php 
+	foreach($groupdata as $groupitem) {
+		?>
+<option value = "<?php echo "g".($groupitem->guid); ?>" > <?php  echo ($groupitem->name);?> </option>
+<?php
+	}
+?>
+<?php 
+	foreach($listdata as $listitem) {
+		?>
+<option value = "<?php echo "l".($listitem->id); ?>" >  <?php echo($listitem->name);?> </option>
+<?php 
+	}
+?>
+<option value="c002">Friends</option>
+<option value="t001">Everyone</option>
+</select>
\ No newline at end of file
diff --git a/plugins/mass_mailouts/views/default/mass_mailouts/css.php b/plugins/mass_mailouts/views/default/mass_mailouts/css.php
new file mode 100644
index 0000000000000000000000000000000000000000..e590abc855d27b5a319db4a7243335bf6e1ee04b
--- /dev/null
+++ b/plugins/mass_mailouts/views/default/mass_mailouts/css.php
@@ -0,0 +1,8 @@
+<?php
+	global $CONFIG;
+	
+?>
+.footnote {
+	color: grey;
+	font-size: 80%;
+}
\ No newline at end of file
diff --git a/plugins/mass_mailouts/views/default/mass_mailouts/form.php b/plugins/mass_mailouts/views/default/mass_mailouts/form.php
new file mode 100644
index 0000000000000000000000000000000000000000..480a8e93bc126c8cf7a9208282de495a55dfc7be
--- /dev/null
+++ b/plugins/mass_mailouts/views/default/mass_mailouts/form.php
@@ -0,0 +1,66 @@
+<?php 
+	$form = "";
+
+	$form .= "<p>" . elgg_echo('mass_mailouts:subject');
+	$form .= elgg_view('input/text',array(
+		'internalname' => 'email_subject',
+		'value' => "" 
+	)) . "</p>";
+	$form .= "<p>" . elgg_echo('mass_mailouts:email_text');
+	$form .= elgg_view('input/longtext',array(
+		'internalname' => 'email_text',
+		'value' => ""
+	))  . "</p>";
+
+	$form .= "<p>" . elgg_echo('mass_mailouts:recipienttype');
+	$form .= elgg_view('input/recipienttype', array('internalname' => 'access_id','value' => "")) . "</p>";
+
+	$form .= elgg_view('input/submit',array(
+		'value' => elgg_echo('mass_mailouts:send')
+	));
+
+	$wrappedform2 = elgg_view('input/form',array(
+		'body' => $form,
+		'internalid' => "massmailForm",
+		'action' => $vars['url'] . "action/mass_mailouts/progressWindow"
+	));
+
+?>
+<script type="text/javascript">
+
+	$(document).ready(function(){
+		$('#massmailForm').submit(function(){
+			<?php
+			if (is_plugin_enabled("tinymce")) {
+				echo "tinyMCE.triggerSave();"; 
+			} 
+			?>
+			var url = this.action + "?" + $('#' + this.id).serialize();
+			var sWidth = screen.width;
+			var sHeight = screen.height;
+			var height = 100;
+			var width = 300;
+			
+			var options = "height=" + height + ",width=" + width + ",menubar=no,toolbar=no,status=no,left=" + ((sWidth / 2) - ( width / 2)) + ",top=" + ((sHeight / 2) - (height / 2)) + ",location=no,resizable=no";
+			
+			window.open(url, "<?php echo elgg_echo("mass_mailouts:progress:window_title"); ?>", options);
+
+			// Reset the form to basic
+			$('#massmailForm').each(function(){
+				this.reset();
+			});
+
+			return false;
+		});
+	});
+</script>
+<div id="mass_mailouts_email_area" class="contentWrapper">
+	<?php echo $wrappedform2; ?>
+	<p class="footnote">
+		<?php echo elgg_echo("mass_mailouts:footnote"); ?><br />
+		<b>[displayname]</b>: <?php echo elgg_echo("mass_mailouts:footnote:displayname"); ?><br />
+		<b>[profile]</b>: <?php echo elgg_echo("mass_mailouts:footnote:profile"); ?><br />
+		<b>[username]</b>: <?php echo elgg_echo("mass_mailouts:footnote:username"); ?><br />
+		<b>[email]</b>: <?php echo elgg_echo("mass_mailouts:footnote:email"); ?><br />
+	</p>
+</div>