Пример #1
0
        	'pj'=>CFunctions::addslashes($toEnvoyes['piece']),
        	'date'=>$zDate));
        $iEmailId = $obj->insert();
        
        // MAIL EN HTML
        
        $pj = ($radioPiece) ? $toEnvoyes['piece'] : '' ;
        $text = $texte['text'] ;
        
        $arr_pj = explode("|", $pj);
		
		$text = $text . '<p style="text-align: center;"><a href="'.URL_RACINE.'/adminpanther/src/email.php?id=' . $iEmailId . '">Visualiser cette email comme page HTML</a></p>';
		
		$text = $text . CDesinscription::insert_link();
		
		$body = CNmail::build_html_body($texte['style'], CFunctions::stripslashes($text));
		
		if(!CMail::send_mailing($liste_email, $texte['nom'], $body, $expediteur, $arr_pj)) {
			$msginfo = "Echec d'envoi d'email. Veuillez r&eacute;essayer ult&eacute;rieurement";
			break;
		}		
		
		$obj = new CTableEmail(array('id'=>$iEmailId, 'expediteur'=>CFunctions::addslashes($expediteur), 'destinataire'=>CFunctions::addslashes($destinataire), 'nom'=>CFunctions::addslashes($texte['nom']), 'text'=>mysql_real_escape_string(CFunctions::addslashes($body)), 'pj'=>CFunctions::addslashes($pj), 'etat'=>1, 'date'=>date("Y-m-d H:i:s")));
		if(is_numeric($iEmailId)) $obj->update(); else $obj->insert();
		$obj->update();
		$msginfo = "Email bien envoy&eacute;<br/>";
    }
    // FIN ENVOI MAIL
	
	$msginfo = "user bien modifi&eacute;";
	$a = 0;
Пример #2
0
                                $resResult = $bdd->select($zSql);
                                $toResult = @mysql_fetch_array($resResult);
                                if (((int)($toResult[0]))>0) {
                                    $zSql3 = "UPDATE retour_email SET retour_email_statut = '0', retour_email_lien='0' WHERE retour_email_id_email ='".$id."' AND retour_email_id_user ='******'";
                                    $resInsert = $bdd->update($zSql3);
                                }
                                else {
                                    $zSql3 = "INSERT INTO retour_email (retour_email_id_email,retour_email_id_user,retour_email_statut,retour_email_lien) VALUES ('".$id."', '".$zUser."', '0', '0')";
                                    $resInsert = $bdd->insert($zSql3);
                                }
                            }
                            if(!empty($_POST['text'])) $text = trim($_POST['text']);
                            $text = $text . '<p style="text-align: center;"><a href="'.URL_RACINE.'/adminpanther/src/email.php?id='.$id.'">Visualiser cette email comme page HTML</a></p>';
                            $text = $text .'<img src ="'.URL_RACINE.'/adminpanther/src/retour.php?id='.$resInsert.'" width="0" height="0" border="0"/>';
                            $text = $text . CDesinscription::insert_link();
                            $body = CNmail::build_html_body($style, CFunction::stripslashes($text));
                            if(!CMail::send_mailing($zEmail, $nom, $body, $expediteur, $arr_pj)) {
                                    //$msginfo = "Echec d'envoi d'email. Veuillez r&eacute;essayer ult&eacute;rieurement";
                                    break;
                            }
                        }
                    }
                    

                    $obj = new CTableEmail(array('id'=>$id, 'expediteur'=>CFunction::addslashes($expediteur), 'destinataire'=>CFunction::addslashes($destinataire), 'nom'=>CFunction::addslashes($nom), 'text'=>mysql_real_escape_string(CFunction::addslashes($body)), 'pj'=>CFunction::addslashes($pj), 'etat'=>1, 'date'=>date("Y-m-d H:i:s")));
                    if(!empty($id)) $obj->update(); else $obj->insert();
                    $obj->update();
                    $msginfo = "Email bien envoy&eacute;";
                }
                else /*($go == "Envoyer à la date pr&eacute;vue")*/ {
                    $obj = new CTableEmail(array('id'=>$id, 'expediteur'=>CFunction::addslashes($expediteur), 'destinataire'=>CFunction::addslashes($destinataire), 'nom'=>CFunction::addslashes($nom), 'text'=>CFunction::addslashes($body), 'pj'=>CFunction::addslashes($pj), 'etat'=>3, 'date'=>$date));
Пример #3
0
	/** Generation de l'email a envoyer pour un destinataire
	 * @param Array _tzData Donnees de l'email
	 */
	function generateAndSend ($_tzData) {
		global $giNbSent;
		$zStr = 'pj';
		$arr_pj = explode ("|", $_tzData[$zStr]);

		$zStr = 'destinataire';
		$liste_email = $_tzData[$zStr];
		if (!is_email($liste_email)) {
			$liste_email = get_liste_email($liste_email,$_tzData['type_envoi']);
		}

		$zStr = 'nom';
		$zStr1 = 'expediteur';
		$zStr2 = 'id';

		$tzEmail = explode (",", $liste_email);
		print "\n\n------------------- INSERT INTO TABLE envoi " . $_tzData[$zStr2] . " -------------------------\n";
		print_r ($tzEmail);
		foreach ($tzEmail AS $iIndex => $zEmail) {
		//-- Ne plas sauvegarder les emails déjà sauvegardé
			$zQuery = "SELECT etat FROM envoi WHERE id_envoi = " . $_tzData[$zStr2] . " AND email = '" . $zEmail . "'";
			if ($tiCount = mysql_fetch_assoc (mysql_query ($zQuery))) {
				if ($tiCount['etat'] == 1) {
					unset ($tzEmail[$iIndex]);
				}
				continue;
			}
		//-- Sauvegarder en base les adresses email à envoyer de l'envoi
			$zQuery = "INSERT INTO envoi (id_envoi, email, etat) VALUES (" . $_tzData[$zStr2] . ", '" . $zEmail . "', 0)";
			mysql_query ($zQuery);
		}
		
		print "\n\n------------------- SEND EMAILS " . $_tzData[$zStr2] . " -------------------------\n";
		print_r ($tzEmail);
		$str_repl = 1;

		$zStr_txt = 'text';
		$zStr_id = 'id';
		$text_init = $_tzData[$zStr_txt];		// Le corps du message initial
			
		foreach ($tzEmail AS $zEmail) {

			// Traitement du lien si le client clique dessus
			$text = str_replace('href="','href="' . URL_RACINE . 'adminpanther/src/redirection.php?a=' . $_tzData[$zStr_id] . '&m=' . $zEmail . '&u=', $text_init);
			if($text == $text_init){
				$text = str_replace('href=\"','href=\"' . URL_RACINE . 'adminpanther/src/redirection.php?a=' . $_tzData[$zStr_id] . '&m=' . $zEmail . '&u=', $text_init);
			}
			

			$text .= '<p style="text-align: center;"><a href="' . URL_RACINE . 'adminpanther/src/email.php?id=' . $_tzData[$zStr_id] . '&m='.$zEmail.'">Visualiser cette email comme page HTML</a></p>';
			$text .= '<img src="' . URL_RACINE . 'adminpanther/src/email.php?id=' . $_tzData[$zStr_id] . '&m='.$zEmail.'" style="width:1px; height:1px;" frameborder="0" />';
//			$text .= '<iframe src="' . URL_RACINE . 'adminpanther/src/email.php?id=' . $_tzData[$zStr_id] . '&m='.$zEmail.'" style="width:1px; height:1px; display: none; width: 1px;" />';
	
			$text .= insert_link($_tzData[$zStr_id]);
      $body = CNmail::build_html_body('', stripslashes($text));
      
      if(!CMail::send_mailing($zEmail, $_tzData[$zStr], $body, $_tzData[$zStr1], $arr_pj)) {
        // $msginfo = "Echec d'envoi d'email. Veuillez r&eacute;essayer ult&eacute;rieurement";
        break;
      }

		//-- Marquer l'email comme envoye a l'adresse
			$zQuery = "UPDATE envoi SET etat = 1 WHERE id_envoi = " . $_tzData[$zStr2] . " AND email = '" . $zEmail . "'";
			mysql_query ($zQuery);
			$giNbSent ++;
			if ($giNbSent == ENVOI_NB_EMAILS_MAXI) {
				break;
			}
		}
	}
Пример #4
0
                        else {
                          $zSql3 = "INSERT INTO retour_email (retour_email_id_email, " . $zColIdUser . ", retour_email_statut, retour_email_lien) VALUES ('" . $id . "', '" . $zUser . "', '1', '0')";
                          $resInsert = $bdd->insert($zSql3);
                        }

                   			// Traitement du lien si le client clique dessus
													$text = str_replace('href="','href="' . URL_RACINE . 'adminpanther/src/redirection.php?a=' . $id . '&m=' . $zEmail . '&u=', $text_init);
													if($text == $text_init){
														$text = str_replace('href=\"','href=\"' . URL_RACINE . 'adminpanther/src/redirection.php?a=' . $id . '&m=' . $zEmail . '&u=', $text_init);
													}


                        $text .= '<p style="text-align: center;"><a href="'.URL_RACINE.'/adminpanther/src/email.php?id='.$id.'&m='.$zEmail.'">Visualiser cette email comme page HTML</a></p>';
                        $text .= '<img src ="'.URL_RACINE.'/adminpanther/src/email.php?id='.$id.'&m='.$zEmail.'" style="width:1px; height:1px;" frameborder="0" />';
                        $text .= CDesinscription::insert_link();
                        $body = CNmail::build_html_body($style, stripslashes($text));
                        if(!CMail::send_mailing($zEmail, $nom, $body, $expediteur, $arr_pj)) {
                          //$msginfo = "Echec d'envoi d'email. Veuillez r&eacute;essayer ult&eacute;rieurement";
                          break;
                        }
                       }
                    }

                  	$obj = new CTableEmail (
                  		array (
                  			'id' => $id,
                  			'expediteur' => CFunction::addslashes($expediteur),
                  			'destinataire' => CFunction::addslashes($destinataire),
                  			'nom' => CFunction::addslashes($nom),
                  			'text' => mysql_real_escape_string(CFunction::addslashes($text)),
                  			'pj' => CFunction::addslashes($pj),
Пример #5
0
		ENVOI
----------------------------------------------------------------------*/

$reception_form = CConfiguration::get_valeur('RECEPT_FORM_AUTO', 'non');
$reception_mail = CConfiguration::get_valeur('RECEPT_MAIL_AUTO', 'non');

if($reception_mail == 'oui') {
	if(!CMail::send_mail($destinataire, $sujet, CNmail::build_html_body('p { margin: 15px;}', $message), $expediteur)) {
		$msginfo = $msgerreur;
	} else {
		$msginfo = $msgconfirm;
	}
}
if($reception_form == 'oui'){
	$sql = "INSERT INTO email(id, nom, text, exp_nom, exp_prenom, expediteur, destinataire, date, imap) VALUES ";
	$sql.= "(null, '". CFunction::force_encode(addslashes($sujet)) . "', '" . CNmail::build_html_body('p { margin: 15px;}',addslashes($message)) . "', '". CFunction::force_encode(addslashes($nom)) . "', '". CFunction::force_encode(addslashes($prenom)) . "', '". $expediteur . "', '". $destinataire . "', '". date('Y-m-d H:i:s') . "', '')";
	
	//echo $sql;
	
	if(CBdd::insert($sql)) {
		$msginfo = $msgconfirm;		
		
		/**/
		
		if($iduser = CBdd::select_one("SELECT id FROM user WHERE email = '" . $expediteur . "'", "id")) {
			/*$sql = "UPDATE user SET nom = '" 
			. htmlentities(addslashes($nom),ENT_COMPAT ,'UTF-8') . "', prenom = '"
			. htmlentities(addslashes($prenom),ENT_COMPAT ,'UTF-8') . "', ville = '', pays = '".$pays."', telephone = '' WHERE email = '" 
			. htmlentities(addslashes($expediteur),ENT_COMPAT ,'UTF-8') . "'";
			
			CBdd::update($sql);*/