<?php
/*******************************************************************************
 *   PhpMailer
 *******************************************************************************
 *   GuppY PHP Script - version 6.0
 *   CeCILL Copyright (C) 2004-2020 by Laurent Duveau
 *   Initiated by Laurent Duveau and Nicolas Alves
 *   Web site = https://www.freeguppy.org/
 *   e-mail   = guppy@freeguppy.org
 *   V6 developed by Lud Bienaimé
 *      with the participation of the GuppY Team
 *******************************************************************************
 *   Latest Changes :
 * v6.00.00 (December 15, 2020) : initial release
 ******************************************************************************/

if (stristr($_SERVER["SCRIPT_NAME"], "phpmailer.inc")) {
  header("location:../index.php");
  die();
}

require 'class/PHPMailerAutoload.php';

$mail = new PHPMailer(); 
$mail->SMTPDebug = 0;
$mail->Debugoutput = 'html';
$mail->isSMTP();                                       // send via SMTP
$mail->CharSet    = $charset;
$mail->Host       = $smtp[0];                          // Serveur Smtp  / sets SMTP server
$mail->SMTPSecure = $smtp[2];                          // sets the prefix to the server ('', ssl, tls)
$mail->SMTPAuth   = $smtp[1] == 'on' ? true : false;   // enable SMTP authentication
$mail->Port       = $smtp[3];                          // N° de port 25 par défaut / set the SMTP port
$mail->Username   = $smtp[4];                          // Votre adresse mail / MAIL adress
$mail->Password   = $smtp[5];                          // Votre Mot de passe / MAIL password
$mail->Subject    = $eSubject;                         // Sujet du mail / MAIL subject
$mail->AltBody    = $eMsgTxt;                           // Message en mode texte / plain text MAIL
$mail->setFrom($eFrom, $FromTo);
$mail->msgHTML($eMsgHtml);
$mail->addAddress($eTo, $FromTo);
$mail->addReplyTo($eFrom, $FromTo);
$mail->ConfirmReadingTo = $eAR;
if (!empty($allCC)) {
    foreach ($allCC as $adr) $mail->addCC($adr, substr($adr, 0, strpos($adr, '@')));
}
if (!empty($eFiles)) {
    foreach ($eFiles as $file) $mail->addAttachment($file[0], $file[1]);
}
$mail->isHTML(true);                                   // Set email format to HTML
if(!$mail->send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
} 
?>