Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
srv
/
data
/
web
/
vhosts
/
716cf56cb2.url-de-test.ws
/
htdocs_backup
/
htdocs
/
palais91
/
functions
/
/srv/data/web/vhosts/716cf56cb2.url-de-test.ws/htdocs_backup/htdocs/palais91/functions/mail.php
<?php require 'functions/Class/PHPMailer/PHPMailerAutoload.php'; $smtp_server = "in-v3.mailjet.com"; $smtp_username = "feef2fe35e6033713e2cf4cc0e65c684"; $smtp_password = "2f25cd3412b3ea3d99b6800ad10cceee"; $smtp_from = "formulaire@bhinternet.fr"; /* ======= */ /* LIVRE D'OR */ /* ======= */ function mailLivreOr($datas){ global $smtp_server; global $smtp_username; global $smtp_password; global $smtp_from; global $email_copie; global $conf_name; global $conf_email; global $conf_email_formulaire1; global $conf_email_formulaire2; $mail = new PHPMailer; //SMTP $mail->isSMTP(); $mail->Host = $smtp_server; // Specify main and backup server $mail->SMTPAuth = true; $mail->Username = $smtp_username; $mail->Password = $smtp_password; $mail->Port = 587; //Configuration $mail->WordWrap = 50; // Set word wrap to 50 characters $mail->isHTML(true); // Set email format to HTML $mail->CharSet = 'UTF-8'; //Variables (sender, receiver, etc.) $mail->From = $smtp_from; $mail->FromName = $conf_name; $mail->addAddress($conf_email_formulaire1, $conf_name); // Add a recipient if(!is_null($conf_email_formulaire2) AND !empty($conf_email_formulaire2)) $mail->addCC($conf_email_formulaire2); $mail->addBCC($email_copie,"BHInternet"); $mail->Subject = 'Formulaire de contact - '.$conf_name; $bodies = bodyMailLivreOr($datas); $mail->Body = $bodies[0]; $mail->AltBody = $bodies[1]; //$mail->SMTPDebug = 1; if(!$mail->send()) { echo "Votre message n'a pas pu nous être transmis. Merci de réessayer, si le problème persiste vous pouvez nous contacter à l'adresse $conf_email"; echo 'Mailer Error: ' . $mail->ErrorInfo; exit; } } function bodyMailLivreOr($datas){ global $conf_addressOnline; $bodyHTML = " <html> <head> <title>Nouveau commentaire sur votre site</title> <meta charset='UTF-8'> </head> <body style='font-family:Segoe UI,Calibri,Arial,sans-serif;font-size:12px;color:#3d3d3d;'> Bonjour,<br><br> <p>Vous avez un nouveau commentaire sur votre site $conf_addressOnline :</p> <p> <h2 style='margin-bottom:5px;'>Fiche contact</h2> Surnom : $datas[0]<br> Note : $datas[1]<br> Commentaire : $datas[2]<br> </p> <p>Pour le valider, merci de cliquer <a href='$conf_addressOnline/adminXXX/'>ici</a>.</p> <br> <hr> <i>Fiche contact généré grâce au référencement de votre site par <a href='http://www.bhinternet.fr' title='Création site internet'>BHInternet</a>.</i> </body> </html> "; $bodyPlain = " Bonjour,\n\n Vous avez un nouveau commentaire sur votre site $conf_addressOnline :\n Surnom : $datas[0]\n Note : $datas[1]\n Commentaire : $datas[2]\n \n \n Fiche contact généré grâce au référencement de votre site par BHInternet. "; return array($bodyHTML,$bodyPlain); } /* ======= */ /* CONTACT */ /* ======= */ function mailContact($data){ global $smtp_server; global $smtp_username; global $smtp_password; global $smtp_from; global $conf_email_copie; global $conf_email_copie2; global $conf_name; global $conf_email; global $conf_email_formulaire1; global $conf_email_formulaire2; $mail = new PHPMailer; //SMTP $mail->isSMTP(); $mail->Host = $smtp_server; // Specify main and backup server $mail->SMTPAuth = true; $mail->Username = $smtp_username; $mail->Password = $smtp_password; $mail->Port = 587; //Configuration $mail->WordWrap = 50; // Set word wrap to 50 characters $mail->isHTML(true); // Set email format to HTML $mail->CharSet = 'UTF-8'; //Variables (sender, receiver, etc.) $mail->From = $smtp_from; $mail->FromName = $conf_name; $mail->addAddress($conf_email_formulaire1, $conf_name); // Add a recipient if(!is_null($conf_email_formulaire2) AND !empty($conf_email_formulaire2)) $mail->addCC($conf_email_formulaire2); $mail->addBCC($conf_email_copie,"BHInternet"); $mail->addBCC($conf_email_copie2,"BHInternet"); $mail->addBCC("hind.hmiche@bhinternet.fr","BHInternet"); //$mail->addBCC("redaadari@gmail.com","BHInternet"); $mail->Subject = 'Formulaire de contact - '.$conf_name; $bodies = bodyMailContact($data); $mail->Body = $bodies[0]; $mail->AltBody = $bodies[1]; //var_dump($data); //var_dump(bodyMailContact($data));//die; if(!$mail->send()) { echo "Votre message n'a pas pu nous être transmis. Merci de réessayer, si le problème persiste vous pouvez nous contacter à l'adresse $conf_email"; echo 'Mailer Error: ' . $mail->ErrorInfo; exit; } } function bodyMailContact($data){ global $conf_addressOnline; global $conf_name_website; $bodyHTML = " <html> <head><title>Formulaire de contact</title><meta charset='UTF-8'></head> <body style='font-family:Segoe UI,Calibri,Arial,sans-serif;font-size:12px;color:#3d3d3d;'> Bonjour,<br><br> <p>Le formulaire de contact de votre site internet <a href='$conf_addressOnline'>$conf_name_website</a> vient d'être complété : </p> <p> <h2 style='margin-bottom:5px;'>Fiche contact</h2>"; foreach($data as $key => $field) { //on check si la value est vide (champ facultatif non rempli) if(is_null($field['value']) || ($field['value'] == '')){ if($key == 'subject'){ $bodyHTML .= "<h2 style='margin-bottom:5px;'>Objet</h2>"; $bodyHTML .= "Non renseigné<br>"; }elseif($key == 'message'){ $bodyHTML .= "<h2 style='margin-bottom:5px;'>Message</h2>"; $bodyHTML .= "Non renseigné<br>"; }elseif($key == 'pseudo'){ //do nothing }else{ $bodyHTML .= $field['label'] . " : Non renseigné<br>"; } }else{ if($key == 'subject'){ $bodyHTML .= "<h2 style='margin-bottom:5px;'>Objet</h2>"; $bodyHTML .= $field['value']."<br>"; }elseif($key == 'message'){ $bodyHTML .= "<h2 style='margin-bottom:5px;'>Message</h2>"; $bodyHTML .= nl2br($field['value'])."\n"; }else{ $bodyHTML .= $field['label'] . " : " .$field['value']."<br>"; } } } $bodyHTML.=" </p> <br> <hr> <i>Fiche contact généré grâce au référencement de votre site par <a href='http://www.bhinternet.fr' title='Création site internet'>BHInternet</a>.</i> </body> </html>"; $bodyPlain = "Bonjour,\n\nLe formulaire de contact de votre site internet $conf_name_website vient d'être complété :\n\nFiche contact : \n"; foreach($data as $key => $field) { //on check si la value est vide (champ facultatif non rempli) if(is_null($field['value']) || ($field['value'] == '')){ if($key == 'subject'){ $bodyPlain .= "\nObjet\n"; $bodyPlain .= "Non renseigné\n"; }elseif($key == 'message'){ $bodyPlain .= "\nMessage\n"; $bodyPlain .= "Non renseigné\n"; }elseif($key == 'pseudo'){ //do nothing }else{ $bodyHTML .= $field['label'] . " : Non renseigné\n"; } }else{ if($key == 'subject'){ $bodyPlain .= "\nObjet\n"; $bodyPlain .= $field['value']."\n"; }elseif($key == 'message'){ $bodyPlain .= "\nMessage\n"; $bodyPlain .= str_ireplace("<br>", "\r\n", $field['value'])."\n"; }else{ $bodyPlain .= $field['label'] . " : " .$field['value']."\n"; } } } $bodyPlain .="\n\n\nFiche contact généré grâce au référencement de votre site par BHInternet."; return array($bodyHTML,$bodyPlain); } /* ===== */ /* DEVIS */ /* ===== */ function mailDevis($data){ global $smtp_server; global $smtp_username; global $smtp_password; global $smtp_from; global $conf_email_copie; global $conf_email_copie2; global $conf_name; global $conf_email2; global $conf_email_formulaire1; global $conf_email_formulaire2; $mail = new PHPMailer; //SMTP $mail->isSMTP(); $mail->Host = $smtp_server; // Specify main and backup server $mail->SMTPAuth = true; $mail->Username = $smtp_username; $mail->Password = $smtp_password; $mail->Port = 587; //Configuration $mail->WordWrap = 50; // Set word wrap to 50 characters $mail->isHTML(true); // Set email format to HTML $mail->CharSet = 'UTF-8'; //Variables (sender, receiver, etc.) $mail->From = $smtp_from; $mail->FromName = $conf_name; $mail->addAddress($conf_email_formulaire1, $conf_name); // Add a recipient if(!is_null($conf_email_formulaire2) AND !empty($conf_email_formulaire2)) $mail->addCC($conf_email_formulaire2); $mail->addBCC($conf_email_copie,"BHInternet"); $mail->addBCC($conf_email_copie2,"BHInternet"); $mail->addBCC("hind@bhgroupe.fr","BHInternet"); $mail->addBCC("info@palaisgroupe.com","BHInternet"); //$mail->addBCC("redaadari@gmail.com","BHInternet"); //$mail->addBCC("redaadari@gmail.com","BHInternet"); //$mail->addBCC("redaadari@gmail.com","BHInternet"); $mail->Subject = 'Formulaire de devis - '.$conf_name; $bodies = bodyMailDevis($data); $mail->Body = $bodies[0]; $mail->AltBody = $bodies[1]; //var_dump($file); /*if (isset($file) && $file['error'] == UPLOAD_ERR_OK) $mail->AddAttachment($file['tmp_name'],$file['name']); */ if ($data['file']['value'] && $data['file']['value']['error'] == UPLOAD_ERR_OK){ $mail->AddAttachment($data['file']['value']['tmp_name'],$data['file']['value']['name']); } /*var_dump($data); var_dump(bodyMailDevis($data));//die;*/ if(!$mail->send()) { echo "Votre message n'a pas pu nous être transmis. Merci de réessayer, si le problème persiste vous pouvez nous contacter à l'adresse $conf_email2"; echo 'Mailer Error: ' . $mail->ErrorInfo; exit; } } function bodyMailDevis($data){ global $conf_addressOnline; global $conf_name_website; $bodyHTML = " <html> <head> <title>Formulaire de devis</title> <meta charset='UTF-8'> </head> <body style='font-family:Segoe UI,Calibri,Arial,sans-serif;font-size:12px;color:#3d3d3d;'> Bonjour,<br><br> <p>Une demande de devis via votre site internet <a href='$conf_addressOnline'>$conf_name_website</a> vient d'être envoyée : </p> <p> <h2 style='margin-bottom:5px;'>Fiche contact</h2>"; foreach($data as $key => $field) { //on check si la value est vide (champ facultatif non rempli ou checkbox non checké) if(is_null($field['value']) || ($field['value'] == '')){ //force_display permet d'afficher les chekbox non checkés if(isset($field['force_display'])){ //pour les checkbox non checkés mettre non if(!isset($field['value'])){ $bodyHTML .= $field['label'] . " : Non<br>\n"; } } if($key == 'message'){ $bodyHTML .= "<h2 style='margin-bottom:5px;'>Message</h2>"; $bodyHTML .= "Non renseigné<br>\n"; } }else{ //pour les checkbox checkés mettre oui if(substr($key, 0, 8) == 'checkbox') { $bodyHTML .= $field['label'] . " : Oui<br>\n"; } //pour les radios elseif(substr($key, 0, 5) == 'radio'){ //$bodyHTML .= $field['label']['title'] . " : " .$field['label']['options']."<br>\n"; $bodyHTML .= $field['label']['title'] . " : " .$field['label']['options'][$data['radio1']['value']]."<br>\n"; /*foreach($field['label']['options'] as $minikey => $options) { if ($field['value'] == $minikey){ $bodyHTML .= $field['label']['title'] . " : " .$options."<br>\n"; } }*/ } //pour le fichier elseif($key == 'file'){ //je fais rien pour le table }elseif($key == 'phone'){ $bodyHTML .= $field['label'] . " : " .$field['value']."<br>\n"; $bodyHTML .= "</p><h2 style='margin-bottom:5px;'>Demande</h2>"; //si messge existe je l'affiche avec son h2 }elseif($key == 'message'){ $bodyHTML .= "<h2 style='margin-bottom:5px;'>Message</h2>"; $bodyHTML .= nl2br($field['value'])."<br>\n"; }else{ $bodyHTML .= $field['label'] . " : " .$field['value']."<br>\n"; } } } $bodyHTML .= " <br> <hr> <i>Devis généré grâce au référencement de votre site par <a href='http://www.bhinternet.fr' title='Création site internet'>BHInternet</a>.</i> </body> </html>"; $bodyPlain = " Bonjour,\n\nUne demande de devis via votre site internet $conf_name_website vient d'être envoyée : \n\nFiche contact\n"; foreach($data as $key => $field) { //on check si la value est vide (champ facultatif non rempli ou checkbox non checké) if(is_null($field['value']) || ($field['value'] == '')){ //force_display permet d'afficher les chekbox non checkés if(isset($field['force_display'])){ //pour les checkbox non checkés mettre non if(!isset($field['value'])){ $bodyPlain .= $field['label'] . " : Non\n"; } } if($key == 'message'){ $bodyPlain .= "\nMessage\n"; $bodyPlain .= "Non renseigné\n"; } }else{ //pour les checkbox checkés mettre oui if(substr($key, 0, 8) == 'checkbox') { $bodyPlain .= $field['label'] . " : Oui\n"; } //pour les radios elseif(substr($key, 0, 5) == 'radio'){ //$bodyHTML .= $field['label']['title'] . " : " .$field['label']['options']."<br>\n"; foreach($field['label']['options'] as $minikey => $options) { if ($field['value'] == $minikey){ $bodyPlain .= $field['label']['title' ] . " : " .$options."\n"; } } } //pour le fichier elseif($key == 'file'){ //je fais rien pour le table }elseif($key == 'phone'){ $bodyPlain .= $field['label'] . " : " .$field['value']."\n"; $bodyPlain .= "\nDemande\n"; //si messge existe je l'affiche avec son h2 }elseif($key == 'message'){ $bodyPlain .= "\nMessage\n"; $bodyPlain .= $field['value']."\n"; }else{ $bodyPlain .= $field['label'] . " : " .$field['value']."\n"; } } } $bodyPlain .="\n\n\nDevis généré grâce au référencement de votre site par BHInternet."; return array($bodyHTML,$bodyPlain); } /* ============ */ /* CONFIRMATION */ /* ============ */ //Email de confirmation à l'utilisateur qui vient de remplir un formulaire de contact ou devis function mailConfirmation($data){ global $smtp_server; global $smtp_username; global $smtp_password; global $smtp_from; global $conf_name; global $conf_email; $mail = new PHPMailer; //SMTP $mail->isSMTP(); $mail->Host = $smtp_server; // Specify main and backup server $mail->SMTPAuth = true; $mail->Username = $smtp_username; $mail->Password = $smtp_password; $mail->Port = 587; //Configuration email $mail->WordWrap = 50; // Set word wrap to 50 characters $mail->isHTML(true); // Set email format to HTML $mail->CharSet = 'UTF-8'; //Variable (sender, receiver, etc) $mail->From = $smtp_from; $mail->FromName = $conf_name; $mail->addAddress($data['email']['value'], $data['firstname']['value']." ".$data['lastname']['value']); // Add a recipient $mail->Subject = 'Confirmation - '.$conf_name; $bodies = bodyMailConfirmation($data); $mail->Body = $bodies[0]; $mail->AltBody = $bodies[1]; if(!$mail->send()) { echo "Votre message n'a pas pu nous être transmis. Merci de réessayer, si le problème persiste vous pouvez nous contacter à l'adresse $conf_email"; echo 'Mailer Error: ' . $mail->ErrorInfo; exit; } } function bodyMailConfirmation($data){ global $conf_addressOnline; global $conf_name_website; global $conf_name; if(date("H")>=22 AND date("H")<6) $dayTime = "nuit"; else if(date("H")>=6 AND date("H")<16) $dayTime = "journée"; else if(date("H")>=16 AND date("H")<19) $dayTime = "fin de journée"; else $dayTime = "soirée"; $bodyHTML = " <html> <head><title>Devis site Internet</title><meta charset='UTF-8'></head> <body style='font-family:Segoe UI,Calibri,Arial,sans-serif;font-size:12px;color:#3d3d3d;'> Bonjour ".$data['firstname']['value'].",<br><br> <p> Votre demande nous a bien été transmise.<br> Notre équipe vous recontactera dans les 24 heures ouvrées le temps de préparer une réponse ou une offre adaptée à votre besoin. </p> <p>Dans l'attente, n'hésitez pas à consulter notre site internet <a href='$conf_addressOnline'>$conf_name_website</a>.</p> <br> <p>L'équipe de $conf_name vous souhaite une bonne $dayTime.</p> </body> </html>"; $bodyPlain = "Bonjour ".$data['firstname']['value'].",\n\nVotre demande nous a bien été transmise.\nNotre équipe vous recontactera dans les 24 heures ouvrées le temps de préparer une réponse ou une offre adaptée à votre besoin.\n\nDans l'attente, n'hésitez pas à consulter notre site internet $conf_addressOnline.\n\n\nL'équipe de $conf_name vous souhaite une bonne $dayTime.\n"; return array($bodyHTML,$bodyPlain); } /* ======== */ /* COMMANDE */ /* ======== */ function mailCommand($data){ global $smtp_server; global $smtp_username; global $smtp_password; global $smtp_from; global $conf_email_copie; global $conf_name; global $conf_email; global $conf_email_formulaire1; global $conf_email_formulaire2; $mail = new PHPMailer; //SMTP $mail->isSMTP(); $mail->Host = $smtp_server; // Specify main and backup server $mail->SMTPAuth = true; $mail->Username = $smtp_username; $mail->Password = $smtp_password; $mail->Port = 587; //Configuration $mail->WordWrap = 50; // Set word wrap to 50 characters $mail->isHTML(true); // Set email format to HTML $mail->CharSet = 'UTF-8'; //Variables (sender, receiver, etc.) $mail->From = $smtp_from; $mail->FromName = $conf_name; $mail->addAddress($conf_email_formulaire1, $conf_name); // Add a recipient if(!is_null($conf_email_formulaire2) AND !empty($conf_email_formulaire2)) $mail->addCC($conf_email_formulaire2); $mail->addBCC($conf_email_copie,"BHInternet"); $mail->Subject = 'Commande - '.$conf_name; $bodies = bodyMailContact($data); $mail->Body = $bodies[0]; //$mail->AltBody = $bodies[1]; if(!$mail->send()) { echo "Votre message n'a pas pu nous être transmis. Merci de réessayer, si le problème persiste vous pouvez nous contacter à l'adresse $conf_email"; echo 'Mailer Error: ' . $mail->ErrorInfo; exit; } } function bodyMailCommand($data){ global $conf_addressOnline; $totalHT = $totalTTC = $totalTVA = $shipping_cost = 0; $cart_name = $_SESSION['cart']['name']; $cart_reference = $_SESSION['cart']['reference']; $cart_price = $_SESSION['cart']['price']; $cart_quantity = $_SESSION['cart']['quantity']; $cart_shipping_cost = $_SESSION['cart']['shipping_cost']; $cart_tax = $_SESSION['cart']['tax']; $bodyHTML = " <html> <head> <title>Commande</title> <meta charset='UTF-8'> </head> <body style='font-family:Segoe UI,Calibri,Arial,sans-serif;font-size:12px;color:#3d3d3d;'> Bonjour,<br><br> <p>Une commande vient d'être effectuée sur <a href='$conf_addressOnline'>$conf_addressOnline</a> : </p> <p> <h2 style='margin-bottom:5px;'>Client</h2> Prénom : ".$data['firstname']['value']."<br> Nom : ".$data['lastname']['value']."<br> Adresse : ".$data['address']['value']."<br> Code postal : ".$data['zipcode']['value']."<br> Ville : ".$data['city']['value']."<br> E-mail : ".$data['email']['value']."<br> Tél. : ".$data['phone']['value']."<br> Informations complémentaires :<br> ".nl2br($data['message']['value'])." </p> </p> <h2 style='margin-bottom:5px;'>Produits</h2> <table class='table table-bordered cart'> <thead> <tr> <th class='span6'>Produit(s)</th> <th class='span2'>Prix unitaire</th> <th class='span2'>Quantité</th> <th class='span2'>Prix total</th> </tr> </thead> <tbody> "; foreach ($_SESSION['cart']['id'] as $i => $article) { echo" <tr> <td> $cart_name[$i]<br> <i><small>Réf. ".$cart_reference[$i]."</small></i> </td> <td><small>".number_format($cart_price[$i],2)." €</small></td> <td> $cart_quantity[$i] </td> <td><b>".number_format($cart_price[$i]*$cart_quantity[$i],2)." €</b></td> </tr> "; $totalHT+=number_format($cart_price[$i]*$cart_quantity[$i],2); $totalTVA+=number_format($cart_price[$i]*$cart_quantity[$i]*$cart_tax[$i]/100,2); $shipping_cost+=number_format($cart_shipping_cost[$i]*$cart_quantity[$i],2); } $totalTTC+=$totalHT + $totalTVA + $shipping_cost; echo" </tbody> </table> <br> <p> Frais de port : $shipping_cost €<br> Total HT : $totalHT €<br> TVA : $totalTVA €<br> <b>Total TTC à régler : $totalTTC €</b><br> </p> </body> </html> "; //$bodyPlain = ""; return array($bodyHTML,$bodyPlain); }