| Current Path : /home/ataenra/www/ATA/INTRANET/Tech/MesSav/ |
| Current File : /home/ataenra/www/ATA/INTRANET/Tech/MesSav/mail.php |
<?php
//Import PHPMailer classes into the global namespace
//These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require '../Outils/phpmailer/src/Exception.php';
require '../Outils/phpmailer/src/PHPMailer.php';
require '../Outils/phpmailer/src/SMTP.php';
require "../Outils/co.php";
$ID=$_GET['ID'];
$Mail1 = $dbco->prepare("SELECT * FROM gest_mes WHERE ID_Mes='$ID'");
$Mail1->execute();
$M1 = $Mail1->fetch(PDO::FETCH_OBJ);
//Create an instance; passing `true` enables exceptions
$mail = new PHPMailer(true);
try {
//IDENTIFIANTS SERVEUR
require "../Outils/CoMail.php";
//DESTINATAIRES
$mail->setFrom('ata.enr@gmail.com', 'ATA ENR');
$mail->addAddress(''.$M1->EmailC.'', ''.$M1->NomC.'');
$mail->addReplyTo('ata.enr@gmail.com', 'Information');
//$mail->addCC(''.$_SESSION['EMAILCOM'].'');
//PIECES JOINTES DU MAIL
//Si pac Seule Air/Eau ou Hybride
//$mail->addAttachment('../../../FICHIERS/MES/'.$ID.'/Simulation/Simulation'.$ID.'.pdf');
//CONTENU DU MAIL
$mail->isHTML(true);
$mail->Subject = 'Votre Mise en service '.$M1->Fabricant.'';
$mail->Body = 'Le fabricant de votre Pompe à chaleur nous a missionné pour réaliser la mise en service de votre installation. Merci de contacter le 03.74.09.08.80 afin de fixer votre rdv ';
//ENVOYER MAIL
$mail->send();
//Actualiser le mailing base Mes
$UP2 = $dbco->prepare("UPDATE gest_mes set ID_Mes = :id, MailC = :MailC where ID_Mes = :id");
$UP2->bindvalue('id',$ID);
$UP2->bindvalue('MailC','Oui');
$UP2->execute();
header("location: ../../../index.php/hmes");
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
?>