diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php
index 11e54b35ee09cf3dc5abccf1398ddc9ca1512bb4..6ad8d6abcc8c3e7b2a4612f3a25bfcd5d8d74a7e 100644
--- a/htdocs/adherents/fiche.php
+++ b/htdocs/adherents/fiche.php
@@ -3,6 +3,7 @@
  * Copyright (C) 2002-2003 Jean-Louis Bergamo   <jlb@j1b.org>
  * Copyright (C) 2004-2011 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2005-2012 Regis Houssin        <regis@dolibarr.fr>
+ * Copyright (C) 2012      Marcos García        <marcosgdf@gmail.com>
  *
  * 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
@@ -40,7 +41,7 @@ $langs->load("companies");
 $langs->load("bills");
 $langs->load("members");
 $langs->load("users");
-
+$langs->load('other');
 
 $action=GETPOST('action','alpha');
 $backtopage=GETPOST('backtopage','alpha');
@@ -53,6 +54,15 @@ $socid=GETPOST('socid','int');
 // Security check
 $result=restrictedArea($user,'adherent',$rowid);
 
+if ($conf->mailmanspip->enabled)
+{
+	include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php';
+
+	$langs->load('mailmanspip');
+
+	$mailmanspip = new MailmanSpip($db);
+}
+
 $object = new Adherent($db);
 $extrafields = new ExtraFields($db);
 
@@ -632,9 +642,9 @@ if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $conf
 {
 	if (! count($object->errors))
 	{
-	    if(!$object->del_to_spip())
+	    if (!$mailmanspip->del_to_spip($object))
 	    {
-	        $errmsg.="Echec de la suppression de l'utilisateur dans spip: ".$object->error."<BR>\n";
+	        $errmsg.= $langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error."<BR>\n";
 	    }
 	}
 }
@@ -643,9 +653,9 @@ if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm
 {
 	if (! count($object->errors))
 	{
-	    if (!$object->add_to_spip())
+	    if (!$mailmanspip->add_to_spip($object))
 	    {
-	        $errmsg.="Echec du rajout de l'utilisateur dans spip: ".$object->error."<BR>\n";
+	        $errmsg.= $langs->trans('AddIntoSpipError').': '.$mailmanspip->error."<BR>\n";
 	    }
 	}
 }
@@ -1194,8 +1204,8 @@ if ($rowid && $action != 'edit')
         // Cree un tableau formulaire
         $formquestion=array();
 		if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label,  'value' => ($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL?true:false));
-		if ($conf->global->ADHERENT_USE_MAILMAN) { $langs->load("mailmanspip"); $formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroMailManEnabled"),'value'=>''); }
-		if ($conf->global->ADHERENT_USE_SPIP)    { $langs->load("mailmanspip"); $formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroSpipEnabled"),'value'=>''); }
+		if ($conf->global->ADHERENT_USE_MAILMAN) { $formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroMailManEnabled"),'value'=>''); }
+		if ($conf->global->ADHERENT_USE_SPIP)    { $formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroSpipEnabled"),'value'=>''); }
 		print $form->formconfirm("fiche.php?rowid=".$rowid,$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion,1);
     }
 
@@ -1251,8 +1261,7 @@ if ($rowid && $action != 'edit')
     */
     if ($action == 'add_spip')
     {
-        $langs->load("mailmanspip");
-        $ret=$form->form_confirm("fiche.php?rowid=".$rowid,"Add to spip","Etes-vous sur de vouloir ajouter cet adherent dans spip ? (serveur : ".ADHERENT_SPIP_SERVEUR.")","confirm_add_spip");
+        $ret=$form->form_confirm("fiche.php?rowid=".$rowid, $langs->trans('AddIntoSpip'), $langs->trans('AddIntoSpipConfirmation'), 'confirm_add_spip');
         if ($ret == 'html') print '<br>';
     }
 
@@ -1261,8 +1270,7 @@ if ($rowid && $action != 'edit')
     */
     if ($action == 'del_spip')
     {
-        $langs->load("mailmanspip");
-        $ret=$form->form_confirm("fiche.php?rowid=$rowid","Supprimer dans spip","Etes-vous sur de vouloir effacer cet adherent dans spip ? (serveur : ".ADHERENT_SPIP_SERVEUR.")","confirm_del_spip");
+        $ret=$form->form_confirm("fiche.php?rowid=$rowid", $langs->trans('DeleteIntoSpip'), $langs->trans('DeleteIntoSpipConfirmation'), 'confirm_del_spip');
         if ($ret == 'html') print '<br>';
     }
 
@@ -1564,10 +1572,8 @@ if ($rowid && $action != 'edit')
 	    // Action SPIP
 	    if ($conf->mailmanspip->enabled && $conf->global->ADHERENT_USE_SPIP)
 	    {
-            include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php';
-            $mailmanspip=new MailmanSpip($db);
+            $isinspip = $mailmanspip->is_in_spip($object);
 
-            $isinspip=$mailmanspip->is_in_spip($object);
 	        if ($isinspip == 1)
 	        {
 	            print "<a class=\"butAction\" href=\"fiche.php?rowid=$object->id&action=del_spip\">".$langs->trans("DeleteIntoSpip")."</a>\n";
@@ -1578,7 +1584,7 @@ if ($rowid && $action != 'edit')
 	        }
 	        if ($isinspip == -1)
 	        {
-	            print '<br><br><font class="error">Failed to connect to SPIP: '.$object->error.'</font>';
+	            print '<br><br><font class="error">'.$langs->trans('SPIPConnectionFailed').': '.$mailmanspip->error.'</font>';
 	        }
 	    }
 
diff --git a/htdocs/langs/en_US/mailmanspip.lang b/htdocs/langs/en_US/mailmanspip.lang
index 14501f7ff416c098f261ef82fa5cc28876b892f7..18f1a684c7aea7f2c9a98ba6c8eda02945c539f6 100644
--- a/htdocs/langs/en_US/mailmanspip.lang
+++ b/htdocs/langs/en_US/mailmanspip.lang
@@ -16,4 +16,11 @@ SPIPTitle=SPIP Content Management System
 DescADHERENT_SPIP_SERVEUR=SPIP Server
 DescADHERENT_SPIP_DB=SPIP database name
 DescADHERENT_SPIP_USER=SPIP database login
-DescADHERENT_SPIP_PASS=SPIP database password
\ No newline at end of file
+DescADHERENT_SPIP_PASS=SPIP database password
+AddIntoSpip=Add into SPIP
+AddIntoSpipConfirmation=Are you sure you want to add this member into SPIP?
+AddIntoSpipError=Failed to add the user in SPIP
+DeleteIntoSpip=Remove from SPIP
+DeleteIntoSpipConfirmation=Are you sure you want to remove this member from SPIP?
+DeleteIntoSpipError=Failed to suppress the user from SPIP
+SPIPConnectionFailed=Failed to connect to SPIP
\ No newline at end of file
diff --git a/htdocs/langs/es_ES/mailmanspip.lang b/htdocs/langs/es_ES/mailmanspip.lang
index 047ea06ce43d7d0a8762352f2d07994ba474766d..c6a14bd5fe982e86b816c78d993555fef285a330 100644
--- a/htdocs/langs/es_ES/mailmanspip.lang
+++ b/htdocs/langs/es_ES/mailmanspip.lang
@@ -16,4 +16,11 @@ SPIPTitle=Sistema de gestión de contenidos SPIP
 DescADHERENT_SPIP_SERVEUR=Servidor SPIP
 DescADHERENT_SPIP_DB=Nombre de la base de datos de SPIP
 DescADHERENT_SPIP_USER=Usuario de la base de datos de SPIP
-DescADHERENT_SPIP_PASS=Contraseña de la base de datos de SPIP
\ No newline at end of file
+DescADHERENT_SPIP_PASS=Contraseña de la base de datos de SPIP
+AddIntoSpip=Añadir a SPIP
+AddIntoSpipConfirmation=¿Está seguro de querer añadir este miembro a SPIP?
+AddIntoSpipError=Ha ocurrido un error al añadir el miembro a SPIP
+DeleteIntoSpip=Borrar de SPIP
+DeleteIntoSpipConfirmation=¿Está seguro de querer borrar este miembro de SPIP?
+DeleteIntoSpipError=Ha ocurrido un error al borrar el miembro de SPIP
+SPIPConnectionFailed=Error al conectar con SPIP
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/mailmanspip.lang b/htdocs/langs/fr_FR/mailmanspip.lang
index 402290af28ef1b350fca678f18ee559dcd5ea720..ac88688a3bd3b50b7882a2054fd7b74e3aadb249 100644
--- a/htdocs/langs/fr_FR/mailmanspip.lang
+++ b/htdocs/langs/fr_FR/mailmanspip.lang
@@ -15,4 +15,11 @@ SPIPTitle=Gestion de contenu SPIP
 DescADHERENT_SPIP_SERVEUR=Serveur SPIP
 DescADHERENT_SPIP_DB=Nom base SPIP
 DescADHERENT_SPIP_USER=Login connexion base SPIP
-DescADHERENT_SPIP_PASS=Mot de passe connexion base SPIP
\ No newline at end of file
+DescADHERENT_SPIP_PASS=Mot de passe connexion base SPIP
+AddIntoSpip=Ajouter dans SPIP
+AddIntoSpipConfirmation=Êtes-vous sur de vouloir ajouter cet adhérent dans SPIP?
+AddIntoSpipError=Echec du rajout de l'utilisateur dans SPIP
+DeleteIntoSpip=Supprimer de spip
+DeleteIntoSpipConfirmation=Êtes-vous sur de vouloir effacer cet adhérent de SPIP?
+DeleteIntoSpipError=Échec de la suppression de l'utilisateur de SPIP
+SPIPConnectionFailed=Échec de connexion à SPIP
diff --git a/htdocs/mailmanspip/class/mailmanspip.class.php b/htdocs/mailmanspip/class/mailmanspip.class.php
index eb6acf0ccfdbe9bb61335e494579f1647e73792c..03f0fbff4b5c6737adb6cb8aa5405cc2674b355a 100644
--- a/htdocs/mailmanspip/class/mailmanspip.class.php
+++ b/htdocs/mailmanspip/class/mailmanspip.class.php
@@ -5,6 +5,7 @@
  * Copyright (C) 2004      Sebastien Di Cintio  <sdicintio@ressource-toi.org>
  * Copyright (C) 2004      Benoit Mortier       <benoit.mortier@opensides.be>
  * Copyright (C) 2009      Regis Houssin        <regis@dolibarr.fr>
+ * Copyright (C) 2012      Marcos García        <marcosgdf@gmail.com>
  *
  * 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
@@ -50,6 +51,104 @@ class MailmanSpip
         $this->db = $db;
     }
 
+    /**
+     * Function used to check if SPIP is enabled on the system
+     * @return boolean
+     */
+    function isSpipEnabled()
+    {
+        if (defined("ADHERENT_USE_SPIP") && (ADHERENT_USE_SPIP == 1))
+        {
+            return true;
+        }
+
+        return false;
+    }
+
+    /**
+     * Function used to check if the SPIP config is correct
+     * @return boolean
+     */
+    function checkSpipConfig()
+    {
+        if (defined('ADHERENT_SPIP_SERVEUR') && defined('ADHERENT_SPIP_USER') && defined('ADHERENT_SPIP_PASS') && defined('ADHERENT_SPIP_DB'))
+        {
+            if (ADHERENT_SPIP_SERVEUR != '' && ADHERENT_SPIP_USER != '' && ADHERENT_SPIP_PASS != '' && ADHERENT_SPIP_DB != '')
+            {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * Function used to connect to SPIP
+     * @return boolean|DoliDB
+     */
+    function connectSpip()
+    {
+        $resource = getDoliDBInstance('mysql', ADHERENT_SPIP_SERVEUR, ADHERENT_SPIP_USER, ADHERENT_SPIP_PASS, ADHERENT_SPIP_DB, ADHERENT_SPIP_PORT);
+
+        if ($resource->ok)
+        {
+            return $resource;
+        }
+        
+        dol_syslog('Error when connecting to SPIP '.ADHERENT_SPIP_SERVEUR.' '.ADHERENT_SPIP_USER.' '.ADHERENT_SPIP_PASS.' '.ADHERENT_SPIP_DB, LOG_ERR);
+
+        return false;
+    }
+
+    /**
+     * Function used to connect to Mailman
+     * @param  object $object Object with the data
+     * @param  string $url    Mailman URL to be called with patterns
+     * @return boolean|string
+     */
+    function callMailman($object, $url)
+    {
+        global $conf;
+
+        //Patterns that are going to be replaced with their original value
+        $patterns = array(
+            '%LISTE%',
+            '%EMAIL%',
+            '%PASSWORD%',
+            '%MAILMAN_ADMINPW%'
+        );
+        $replace = array(
+            $list,
+            $object->email,
+            $object->pass,
+            $conf->global->ADHERENT_MAILMAN_ADMINPW
+        );
+
+        $curl_url = str_replace($patterns, $replace, $url);
+        dol_syslog('Calling Mailman: '.$curl_url);
+
+        $ch = curl_init($curl_url);
+
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+        curl_setopt($ch, CURLOPT_FAILONERROR, true);
+        @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
+        curl_setopt($ch, CURLOPT_TIMEOUT, 5);
+        
+        $result = curl_exec($ch);
+        dol_syslog('result curl_exec='.$result);
+
+        //An error was found, we store it in $this->error for later 
+        if ($result === false || curl_errno($ch) > 0)
+        {
+            $this->error = curl_errno($ch).' '.curl_error($ch);
+            dol_syslog('Error using curl '.$this->error, LOG_ERR);
+        }
+
+        curl_close($ch);
+
+        return $result;
+    }
+
     /**
      *  Fonction qui donne les droits redacteurs dans spip
      *
@@ -60,38 +159,36 @@ class MailmanSpip
     {
         dol_syslog(get_class($this)."::add_to_spip");
 
-        if (defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1 &&
-        defined('ADHERENT_SPIP_SERVEUR') && ADHERENT_SPIP_SERVEUR != '' &&
-        defined('ADHERENT_SPIP_USER') && ADHERENT_SPIP_USER != '' &&
-        defined('ADHERENT_SPIP_PASS') && ADHERENT_SPIP_PASS != '' &&
-        defined('ADHERENT_SPIP_DB') && ADHERENT_SPIP_DB != ''
-        )
+        if ($this->isSpipEnabled())
         {
-            require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
-            $mdpass=dol_hash($object->pass);
-            $htpass=crypt($object->pass,makesalt());
-            $query = "INSERT INTO spip_auteurs (nom, email, login, pass, htpass, alea_futur, statut) VALUES(\"".$object->firstname." ".$object->lastname."\",\"".$object->email."\",\"".$object->login."\",\"$mdpass\",\"$htpass\",FLOOR(32000*RAND()),\"1comite\")";
+            if ($this->checkSpipConfig())
+            {
+                $mydb = $this->connectSpip();
 
-            $mydb=getDoliDBInstance('mysql',ADHERENT_SPIP_SERVEUR,ADHERENT_SPIP_USER,ADHERENT_SPIP_PASS,ADHERENT_SPIP_DB,ADHERENT_SPIP_PORT);
+                if ($mydb)
+                {
+                    require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
+                    $mdpass=dol_hash($object->pass);
+                    $htpass=crypt($object->pass,makesalt());
+                    $query = "INSERT INTO spip_auteurs (nom, email, login, pass, htpass, alea_futur, statut) VALUES(\"".$object->firstname." ".$object->lastname."\",\"".$object->email."\",\"".$object->login."\",\"$mdpass\",\"$htpass\",FLOOR(32000*RAND()),\"1comite\")";
 
-            if (! $mydb->ok)
-            {
-                $this->error=$mydb->lasterror();
-                return 0;
-            }
+                    $result = $mydb->query($query);
 
-            $result = $mydb->query($query);
-            if ($result)
-            {
-                $mydb->close();
-                return 1;
-            }
-            else
-            {
-                $this->error=$mydb->lasterror();
-                return 0;
+                    $mydb->close();
+
+                    if ($result)
+                    {
+                        return 1;
+                    }
+                    else $this->error = $mydb->lasterror();
+                }
+                else $this->error = 'Failed to connect to SPIP';
             }
+            else $this->error = 'BadSPIPConfiguration';
         }
+        else $this->error = 'SPIPNotEnabled';
+        
+        return 0;
     }
 
     /**
@@ -102,30 +199,35 @@ class MailmanSpip
      */
     function del_to_spip($object)
     {
-        if (defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1 &&
-        defined('ADHERENT_SPIP_SERVEUR') && ADHERENT_SPIP_SERVEUR != '' &&
-        defined('ADHERENT_SPIP_USER') && ADHERENT_SPIP_USER != '' &&
-        defined('ADHERENT_SPIP_PASS') && ADHERENT_SPIP_PASS != '' &&
-        defined('ADHERENT_SPIP_DB') && ADHERENT_SPIP_DB != ''
-        )
+        dol_syslog(get_class($this)."::del_to_spip");
+
+        if ($this->isSpipEnabled())
         {
-            $query = "DELETE FROM spip_auteurs WHERE login='".$object->login."'";
+            if ($this->checkSpipConfig())
+            {
+                $mydb = $this->connectSpip();
+
+                if ($mydb)
+                {
+                    $query = "DELETE FROM spip_auteurs WHERE login='".$object->login."'";
 
-            $mydb=getDoliDBInstance('mysql',ADHERENT_SPIP_SERVEUR,ADHERENT_SPIP_USER,ADHERENT_SPIP_PASS,ADHERENT_SPIP_DB,ADHERENT_SPIP_PORT);
+                    $result = $mydb->query($query);
 
-            $result = $mydb->query($query);
-            if ($result)
-            {
-                $mydb->close();
-                return 1;
-            }
-            else
-            {
-                $this->error=$mydb->lasterror();
-                $mydb->close();
-                return 0;
+                    $mydb->close();
+
+                    if ($result)
+                    {
+                        return 1;
+                    }
+                    else $this->error = $mydb->lasterror();
+                }
+                else $this->error = 'Failed to connect to SPIP';
             }
+            else $this->error = 'BadSPIPConfiguration';
         }
+        else $this->error = 'SPIPNotEnabled';
+        
+        return 0;
     }
 
     /**
@@ -136,48 +238,46 @@ class MailmanSpip
      */
     function is_in_spip($object)
     {
-        if (defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1 &&
-        defined('ADHERENT_SPIP_SERVEUR') && ADHERENT_SPIP_SERVEUR != '' &&
-        defined('ADHERENT_SPIP_USER') && ADHERENT_SPIP_USER != '' &&
-        defined('ADHERENT_SPIP_PASS') && ADHERENT_SPIP_PASS != '' &&
-        defined('ADHERENT_SPIP_DB') && ADHERENT_SPIP_DB != '')
+        if ($this->isSpipEnabled())
         {
-            $query = "SELECT login FROM spip_auteurs WHERE login='".$object->login."'";
-
-            $mydb=getDoliDBInstance('mysql',ADHERENT_SPIP_SERVEUR,ADHERENT_SPIP_USER,ADHERENT_SPIP_PASS,ADHERENT_SPIP_DB,ADHERENT_SPIP_PORT);
-
-            if ($mydb->ok)
+            if ($this->checkSpipConfig())
             {
-                $result = $mydb->query($query);
+                $mydb = $this->connectSpip();
 
-                if ($result)
+                if ($mydb)
                 {
-                    if ($mydb->num_rows($result))
+                    $query = "SELECT login FROM spip_auteurs WHERE login='".$object->login."'";
+
+                    $result = $mydb->query($query);
+
+                    if ($result)
                     {
-                        // nous avons au moins une reponse
-                        $mydb->close($result);
-                        return 1;
+                        if ($mydb->num_rows($result))
+                        {
+                            // nous avons au moins une reponse
+                            $mydb->close($result);
+                            return 1;
+                        }
+                        else
+                        {
+                            // nous n'avons pas de reponse => n'existe pas
+                            $mydb->close($result);
+                            return 0;
+                        }
                     }
                     else
                     {
-                        // nous n'avons pas de reponse => n'existe pas
-                        $mydb->close($result);
-                        return 0;
+                        $this->error = $mydb->lasterror();
+                        $mydb->close();
                     }
                 }
-                else
-                {
-                    $this->error=$mydb->lasterror();
-                    $mydb->close();
-                    return -1;
-                }
-            }
-            else
-            {
-                $this->error="Failed to connect ".ADHERENT_SPIP_SERVEUR." ".ADHERENT_SPIP_USER." ".ADHERENT_SPIP_PASS." ".ADHERENT_SPIP_DB;
-                return -1;
+                else $this->error = 'Failed to connect to SPIP';
             }
+            else $this->error = 'BadSPIPConfiguration';
         }
+        else $this->error = 'SPIPNotEnabled';
+
+        return -1;
     }
 
     /**
@@ -224,44 +324,13 @@ class MailmanSpip
                     }
                 }
 
-                // on remplace dans l'url le nom de la liste ainsi
-                // que l'email et le mot de passe
-                $patterns = array (
-    				'/%LISTE%/',
-    				'/%EMAIL%/',
-    				'/%PASSWORD%/',
-    				'/%MAILMAN_ADMINPW%/'
-				);
-				$replace = array (
-    				$list,
-    				$object->email,
-    				$object->pass,
-    				$conf->global->ADHERENT_MAILMAN_ADMINPW
-				);
-				$curl_url = preg_replace($patterns, $replace, $conf->global->ADHERENT_MAILMAN_URL);
-
-                dol_syslog("Call URL to subscribe : ".$curl_url);
-				$ch = curl_init();
-				curl_setopt($ch, CURLOPT_URL,"$curl_url");
-				//curl_setopt($ch, CURLOPT_URL,"http://www.j1b.org/");
-				curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-				curl_setopt($ch, CURLOPT_FAILONERROR, true);
-				@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
-				curl_setopt($ch, CURLOPT_TIMEOUT, 5);
-				//curl_setopt($ch, CURLOPT_POST, 0);
-				//curl_setopt($ch, CURLOPT_POSTFIELDS, "a=3&b=5");
-				//--- Start buffering
-				$result=curl_exec($ch);
-				dol_syslog('result curl_exec='.$result);
-				//--- End buffering and clean output
-				if ($result === false || curl_errno($ch) > 0)
+                //We call Mailman to subscribe the user
+                $result = $this->callMailman($object, $conf->global->ADHERENT_MAILMAN_URL);
+
+				if ($result === false)
 				{
-				    // error
-				    $this->error=curl_errno($ch).' '.curl_error($ch);
-				    dol_syslog('Error using curl '.$this->error, LOG_ERR);
 				    return -2;
 				}
-				curl_close($ch);
             }
             return count($lists);
         }
@@ -306,44 +375,13 @@ class MailmanSpip
                     }
                 }
 
-                // on remplace dans l'url le nom de la liste ainsi
-                // que l'email et le mot de passe
-                $patterns = array (
-    				'/%LISTE%/',
-    				'/%EMAIL%/',
-    				'/%PASSWORD%/',
-    				'/%MAILMAN_ADMINPW%/'
-				);
-				$replace = array (
-    				trim($list),
-    				$object->email,
-    				$object->pass,
-    				$conf->global->ADHERENT_MAILMAN_ADMINPW
-				);
-				$curl_url = preg_replace($patterns, $replace, $conf->global->ADHERENT_MAILMAN_UNSUB_URL);
-
-                dol_syslog("Call URL to unsubscribe : ".$curl_url);
-				$ch = curl_init();
-				curl_setopt($ch, CURLOPT_URL,"$curl_url");
-				//curl_setopt($ch, CURLOPT_URL,"http://www.j1b.org/");
-				curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
-				curl_setopt($ch, CURLOPT_FAILONERROR, 1);
-				@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
-				curl_setopt($ch, CURLOPT_TIMEOUT, 5);
-				//curl_setopt($ch, CURLOPT_POST, 0);
-				//curl_setopt($ch, CURLOPT_POSTFIELDS, "a=3&b=5");
-				//--- Start buffering
-				$result=curl_exec($ch);
-				dol_syslog($result);
-				//--- End buffering and clean output
-				if ($result === false || curl_errno($ch) > 0)
+                //We call Mailman to unsubscribe the user
+                $result = $this->callMailman($object, $conf->global->ADHERENT_MAILMAN_UNSUB_URL);
+
+				if ($result === false)
 				{
-				    $this->error=curl_errno($ch).' '.curl_error($ch);
-				    dol_syslog('Error using curl '.$this->error, LOG_ERR);
-				    // error
 				    return -2;
 				}
-				curl_close($ch);
             }
             return count($lists);
         }
diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php
index efd4b1c3d4702e07d64ed3d55b83b1d0a8581770..417430ae1b02349c17a605e41ba70305c45113f7 100644
--- a/htdocs/public/members/new.php
+++ b/htdocs/public/members/new.php
@@ -254,6 +254,8 @@ if ($action == 'add')
         $result=$adh->create($user->id);
         if ($result > 0)
         {
+			require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
+
             // Send email to say it has been created and will be validated soon...
             if (! empty($conf->global->ADHERENT_AUTOREGISTER_MAIL) && ! empty($conf->global->ADHERENT_AUTOREGISTER_MAIL_SUBJECT))
             {