Your IP : 216.73.216.65


Current Path : /home/ataenra/www/ATA/INTRANET/GenPDF/4DossierClient/
Upload File :
Current File : /home/ataenra/www/ATA/INTRANET/GenPDF/4DossierClient/mailcommande.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_once '../Outils/phpmailer/src/Exception.php';
require_once '../Outils/phpmailer/src/PHPMailer.php';
require_once '../Outils/phpmailer/src/SMTP.php';

//connexion a la base de donnée

//require_once '../Outils/co.php';

//Create an instance; passing `true` enables exceptions




$mail = new PHPMailer();


    //Server settings

    //$mail->SMTPDebug = SMTP::DEBUG_SERVER;                      //Enable verbose debug output

    $mail->isSMTP();                                            //Send using SMTP

    $mail->Host       = 'smtp.gmail.com';                     //Set the SMTP server to send through

    $mail->SMTPAuth   = true;                                   //Enable SMTP authentication

    $mail->Username   = 'ata.enr@gmail.com';                     //SMTP username

    $mail->Password   = 'iyjaoyhmexxaiexi';                               //SMTP password

    $mail->SMTPSecure = 'ssl';            //Enable implicit TLS encryption

    $mail->Port       = 465;                                    //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`




    //Recipients

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

    $mail->addAddress(''.$IFRS->frs_email.'', '');     //Add a recipient           

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

    $mail->addCC('ata.enr@gmail.com');

    
    //Attachments

    $mail->addAttachment('../../FICHIERS/'.$ID.'/Chantier/Commande'.$lastcom.'.pdf'); 


    //Content

    $mail->isHTML(true);                                  //Set email format to HTML

    $mail->Subject = 'Commande ATA : '.$lastcom.' du dossier Num : '.$ID.'';

    $mail->Body    = "Bonjour Mr ".$IFRS->frs_contact.", vous trouverez ci-joint le bordereau de commande.";


    if (!$mail->send()) {
        echo 'Erreur de Mailer : ' . $mail->ErrorInfo;
    } else {
        echo 'Le message a été envoyé.';
        unset($mail);
    }
    //$mail->send();
    $mail=0;

?>