Index: /extensions/Mail_supervisor/include/function_test_send.php
===================================================================
--- /extensions/Mail_supervisor/include/function_test_send.php	(revision 4043)
+++ /extensions/Mail_supervisor/include/function_test_send.php	(revision 4043)
@@ -0,0 +1,222 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2009 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program 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      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+if ( !defined('PHPWG_ROOT_PATH')) 
+{
+  die('Hacking attempt!');
+}
+if (!defined('MAILl_SUPERV_DIR')) define('MAILl_SUPERV_DIR' , basename(dirname(__FILE__)));
+if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
+
+function test_envoie($message,$group_name,$group_id)
+{
+    global $infos_message,$erreur_message ,$conf,$user,$conf_mail,$mail_données,$args ;
+	$mailto="";  
+	
+
+//==================================================================================
+if (!isset($infos_message))
+	{
+    	$infos_message = "";
+	}
+if (!isset($erreur_message))
+	{
+    	$erreur_message = '';
+	}
+if (!isset($mails_données))
+	{
+    	$mails_données = Get_Datas();
+	}		
+if (!isset($conf_mail))
+  {
+    	$conf_mail = get_mail_configuration();
+  }
+  	  if (isset($args))
+  { 
+    $infos_message=memo_var($args);
+  }else{
+  	$args = array();
+	}
+//=====================================================================================================
+
+  
+
+ 
+$groups=get_liste($group_id);
+
+ 
+//=======================================================================================
+  if (count($groups) > 0)
+  {
+ //===========================================================
+  	$args['Bcc']=$groups;
+	$args['from'] = $conf_mail['formated_email_webmaster'];
+
+  
+  
+	//==================================================================
+	 $message_texte=sprintf(
+        l10n('message_texte %s %s %s %s'),
+        format_date( date("Y-m-d H:i:s")),
+		$group_name,
+		$message,
+		$args['from']
+        );	
+	$message_texte .=$message;	
+ 	//==================================================================
+	$message_html=$message_texte;
+	$message_html .=  	'<img src="'.PHPWG_ROOT_PATH.'admin/template/goto/theme/roma/images/piwigo_logo_sombre_214x100.png" />';
+	 
+	
+ //==========================================================================
+
+    	$args['subject']="Plugin Piwigo TEST";
+    	$args['content']=$message_html;
+        $ret= pwg_mail($mailto , $args); 
+		
+		 $infos_message .=    sprintf( l10n('An information email was sent to group "%s"'), $group_name ).'<br />';
+
+		 
+	}else{
+	       $infos_message .=l10n('no_receiver_available') ;
+	}
+	
+}
+//===============================================================================================================
+function mail_attachement($args)
+{
+ global $infos_message,$erreur_message ,$conf,$user,$conf_mail,$mail_données ;
+
+    $mails_données = Get_Datas();
+	  if (!isset($conf_mail))
+  {
+    $conf_mail = get_mail_configuration();
+  }
+
+
+
+  		$nom ='piwigo_logo_sombre_214x100.png'; 
+		$fichier=PHPWG_ROOT_PATH.'admin/template/goto/theme/roma/images/piwigo_logo_sombre_214x100.png' ;
+		$typemime='image/jpeg';
+				
+		$fd = fopen( $fichier, "r" ); 
+  		$contenu = fread( $fd, filesize( $fichier ) ); 
+  		fclose( $fd ); 
+  		$piecejointe  = chunk_split(base64_encode($contenu)); 
+		
+		
+	 $from=$args['from'];
+$to="";
+
+     $message_texte=sprintf(
+        l10n('message_texte %s %s %s'),
+        format_date( date("Y-m-d H:i:s")),
+		$to,
+		$from
+        );	
+		
+ 
+	$message_html =  	'<img src="'.PHPWG_ROOT_PATH.'admin/template/goto/theme/roma/images/piwigo_logo_sombre_214x100.png" />';
+	 ob_start();	
+ 
+	echo str_replace("\n","<br />",$message_texte);
+	
+	 $message_html .= ob_get_contents()."\n";
+	 //ob_flush();
+   	ob_end_clean();
+
+       $limite=$conf_mail['boundary_key'];   
+  		$headers =   date("Y-m-d H:i:s") ."\n"; 
+
+  //=======================================================================================
+ 		$headers = "From: ".$args['from']."\n";
+ 		$headers.= "Reply-To: ".$args['from']."\n";
+  		$nb_destinataires=0;
+$destinataire = $conf_mail['email_webmaster'];
+
+  
+   		if (!empty($args['Cc']))
+  		{$nb_destinataires += count($args['Cc']);
+		 $to= explode(',', $args['Cc']);
+		 $headers	.= get_strict_email_list($to) ;
+		    
+  		}
+  		if (!empty($args['Bcc']))
+  		{  $nb_destinataires += count($args['Bcc']); 
+	    $to = implode(',', $args['Bcc']);
+	    $headers	.= 'Bcc :'.get_strict_email_list($to)."\n" ;
+		   
+		}
+
+  $headers.= 'Content-Type: multipart/alternative;'."\n";
+  $headers.= '  boundary="---='.$limite.'";'."\n";
+  $headers.= '  reply-type=original'."\n";
+  $headers.= 'MIME-Version: 1.0'."\n";
+  $headers.= 'X-Mailer: Piwigo Mailer'."\n";
+
+  //Le message en texte simple pour les navigateurs qui n'acceptent pas le HTML 
+    $texte = "This is a multi-part message in MIME format.\n"; 
+	
+    	$texte .= "-----=".$limite."\n"; 
+      	$texte .= "Ceci est un message est au format MIME.\n"; 
+      	$texte .= 'Content-Type: text/plain; charset="UTF-8"'."\n"; 
+      	$texte .= 'Content-Transfer-Encoding: 8bit'."\n\n";  
+      	$texte .= $message_texte ; 
+	  	$texte .= "\n\n"; 
+		
+   		$texte .= "-----=".$limite."\n"; 
+      	$texte .= 'Content-Type: text/html; charset="UTF-8"'."\n"; 
+      	$texte .= 'Content-Transfer-Encoding: 8bit'."\n\n";  
+     	$texte .= $message_html; 
+      	$texte .= "\n\n"; 
+	  
+
+
+  		$attachement = "-----=".$limite."\n"; 
+  		$attachement .= "Content-Type: ".$typemime."; name=\"".$nom."\"\n"; 
+  		$attachement .= "Content-Transfer-Encoding: base64\n"; 
+  		$attachement .= "Content-Disposition: attachment; filename=\"".$nom."\"\n\n"; 
+  		$attachement .= $piecejointe; 
+  		$attachement .= "\n\n\n-----=".$limite."\n"; 
+
+
+  $ret=false;
+
+ob_start();
+
+    $ret= mail( $destinataire, $args['subject'], $texte.$attachement, $headers); 
+   $message =  ob_get_contents() ;
+	//ob_flush();
+   ob_end_clean();
+   if (($message)<>"") {
+   $erreur_message .=  $message ;
+   $infos_message =  "-------------------";
+   }
+
+   
+    return  $ret;
+  
+}
+
+ 
+?>
