Your IP : 216.73.216.65


Current Path : /home/a/t/a/ataenra/www/ATA/INTRANET/MesSav/
Upload File :
Current File : /home/a/t/a/ataenra/www/ATA/INTRANET/MesSav/mailP.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 './ATA/INTRANET/Outils/phpmailer/src/Exception.php';

require './ATA/INTRANET/Outils/phpmailer/src/PHPMailer.php';

require './ATA/INTRANET/Outils/phpmailer/src/SMTP.php';

require "./ATA/INTRANET/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);

$dateP1 = $M1->DateP; $DS2 = new DateTime($dateP1);
//Mail pour planification

$mail = new PHPMailer(true);

try {

    //IDENTIFIANTS SERVEUR

    require "./ATA/INTRANET/Outils/CoMail.php";



    //DESTINATAIRES

    $mail->setFrom('ata.enr@gmail.com', 'ATA ENR');

    $mail->addAddress(''.$M1->EmailI.'', ''.$M1->RaisonS.'');             

    $mail->addReplyTo('ata.enr@gmail.com', 'MES');

    //$mail->addCC(''.$_SESSION['EMAILCOM'].'');

    //CONTENU DU MAIL

    $mail->isHTML(true);                                
    $mail->Subject = 'Plannification Mise en service '.$M1->Fabricant.'';
    $mail->Body    = 'Confirmation de mise en service. Prévue le '.$DS2->Format('d-m-Y').'. Pour rappel votre présence est obligatoire.';

    //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}";

}

//mail2






?>