Preview
ini.inc
envoi.php
add_header('Content-Transfer-Encoding: 8bit');
$mail->add_header("X-Priority: ".$prior."");
$mail->add_header("Return-Path: <".$from.">");
$mail->add_header("Reply-To: ".$from."");
$mail->add_header("To: ".$toDest."");
if (isset($cc)) {$mail->add_header("Cc : ".$cc."");}
if (isset($bcc)) {$mail->add_header("Bcc : ".$bcc."");}
/*La variable $to est utilisée par l'objet SMTP*/
$to = array($toDest,$cc,$bcc);
/* Gestion des pièces jointes - si le fichier existe on l'upload sur le
serveur puis on l'ajoute au mail*/
(6) if ($fichier_name<>"") {
move_uploaded_file($fichier,$fichier_name);
$attachment = fread($fp = fopen($fichier_name, 'rb'),
filesize($fichier_name));
fclose($fp);
$mail->add_attachment($attachment, $fichier_name,
'application/octet-stream');}
/* Création du corps du mail au format texte ou html et encodage dans un
format propre à conserver les accents et les caractères spéciaux */
(7) $html="\r\n".$msg."\r\n";
if ($format=="h") {$mail->add_html($html, $msg);}
if ($format=="t") {$mail->set_body($msg);}
$mail->set_charset('iso-8859-1', TRUE);
$mail->build_message();
/* Instanciation de l'objet SMTP avec passage des paramètres*/
(8) $smtp = new smtp_class;
$smtp->host_name = $hostname;
$smtp->localhost = $localhost;
$mail->Smtp_send('smtp', $from, $to, $subject, $headers);
include('head.inc');
echo "Message envoyé avec succès";
?>