HHH-www/classes/errormailer.php

71 lignes
2.4 KiB
PHP

<?php
//Reglage du fuseau horaire
date_default_timezone_set('Europe/Paris');
// Domaine d'envoi
$domaine = "anesis.tk";
require 'phpmailer/PHPMailerAutoload.php';
//Appel PHP Mailer
$mail = new PHPMailer();
// encodage de l'email (doit être similaire à la source).
$mail->CharSet = 'UTF-8';
// Selection du protocole SMTP
// $mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//Adresse SMTP
$mail->Host = "mail.".$domaine;
//Port SMTP (25, 465 ou 587)
$mail->Port = 25;
//Authentification activé ?
$mail->SMTPAuth = true;
//Login SMTP
$mail->Username = "contact@".$domaine;
//Password SMTP
$mail->Password = "tiramisu";
//EXPEDITEUR
$mail->setFrom('contact@'.$domaine, 'Contact HHH');
//ADRESSE DE REPONSE
// $mail->addReplyTo($email,$nom);
//DESTINATAIRE
$mail->addAddress('contact@'.$domaine, 'Contact HHH');
//SUJET DU MAIL
$mail->Subject = "Nouvelle erreur sur HHH";
//Pour inclure une page html externe au lieu du simple html :
// $mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
//MESSAGE html
$messmail=nl2br($contenu);// on ajoute les sauts de ligne html
$mail->msgHTML('<html><body><table width="580" align="center" cellpadding="0" cellspacing="0" style="font-family:sans-serif;border-style:solid;border-width:2px;border-color:#999"><tr><td width="580" style="font-size: 20px;background-color:#999;color:#FFF;padding:5px;">Vous avez reçu une nouvelle erreur.</td></tr><tr><td style="color: #494949;font-size: 12px;padding:5px;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:#E4E4E4;background-color: #E4E4E4">Type d\'erreur : '.$errortype.'<br/> Intitulé de l\'erreur : '.$errortitre.'</td></tr><tr><td style="font-size:14px;padding: 10px;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:#E4E4E4">'.$messmail.'</td></tr><tr><td style="font-size:10px;padding: 5px;"></td></tr></table></body></html>');
//MESSAGE texte
$mail->AltBody = 'Vous avez reçu une nouvelle erreur. Type: '.$errortype.'\r\n Intitulé : '.$errortitre.'\r\n'.$messmail;
//pour attacher un fichier :
// $mail->addAttachment('images/phpmailer_mini.gif');
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>