Your IP : 216.73.216.65


Current Path : /home/ataenra/www/ATA/INTRANET/GenPDF/12Devis/
Upload File :
Current File : /home/ataenra/www/ATA/INTRANET/GenPDF/12Devis/mailDevis.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';

//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(''.$R->email.'', ''.$R->nom.' '.$R->prenom. '');             
    $mail->addReplyTo('ata.enr@gmail.com', 'Information');
    //$mail->addCC(''.$_SESSION['EMAILCOM'].'');
    
    //PIECES JOINTES DU MAIL
    //Si pac Seule Air/Eau ou Hybride
    if($R->PrimeATA=="Oui"){
    $mail->addAttachment('../../../FICHIERS/'.$ID.'/Devis/DevisSonergia'.$ID.'.pdf');

    //CONTENU DU MAIL
    $mail->isHTML(true);                                
    $mail->Subject = 'Votre Devis ATA Numero : '.$numdevis.'';
    $mail->Body    = "Faisant suite à votre simulation et au controle des informations fournies, veuillez trouver ci-joint le devis envoyé a Sonergia pour Validation des aides de l'état.";
    }else{
    $mail->addAttachment('../../../FICHIERS/'.$ID.'/Devis/DevisFinal'.$ID.'.pdf');

    //CONTENU DU MAIL
    $mail->isHTML(true);                                
    $mail->Subject = 'Votre Devis ATA Numero : '.$numdevis.'';
    $mail->Body    = 'Faisant suite à votre simulation et au controle des informations fournies, veuillez trouver ci-joint le devis : <b>'.$numdevis.'</b>';

    }


    //ENVOYER MAIL
    $mail->send();
    
} catch (Exception $e) {
    echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}

?>