Forum » » Le coin des codeurs » » integrer class phpmailer
Posté : 30 mars 2008 à 22:41
#autodoc send_email($email, $subject, $message, $from, $priority, $mime) : Pour envoyer un mail en texte ou html via les fonctions mail ou email
function send_email($email, $subject, $message, $from="", $priority=false, $mime=false) {
global $mail_fonction, $adminmail;
if (($mail_fonction==1) or ($mail_fonction=="")) {
$From_email=$adminmail;
if ($from!="") { $From_email=$from; }
require "modules/newsletter/phpmailer/class.phpmailer.php";
$mail = new PHPmailer();
$mail->IsSMTP();
$mail->IsHTML(true);
$mail->Host='smtp.xxx.fr';
$mail->From= $From_email;
$mail->FromName = 'Webmaster';
$mail->AddAddress($email);
$mail->AddReplyTo($From_email);
$mail->Subject=$subject;
$mail->Body=$message;
$result=$mail->Send();
echo $email;
echo $result;
$mail->SmtpClose();
unset($mail);
} else {
$pos = strpos($adminmail, "@");
$tomail=substr($adminmail,0,$pos);
$result=email($tomail, $email, $subject, $message, $tomail, "Return-Path:\nX-Mailer: NPDS\n$advance");
}
if ($result) {
return (true);
} else {
return (false);
}
}
echo $email;
echo $result;
$result=$mail->Send();
Cet article provient de NPDS
https://www.npds.org/viewtopic.php?topic=23428&forum=5