<?php
/*------------------------------*/
/*
Titre : Envoi de mails en mode texte et HTML
Auteur : KOogar
Date édition : 16 Avril 2009
Date mise a jour : 19 Aout 2019
Rapport de la maj:
- fonctionnement du code vérifié
- modification de la description
*/
/*------------------------------*/
$texte_plain = "titre \n";
$texte_plain .= "votre texte \n";
$texte_plain .= "a ecrire ici \n";
$texte_html = "<strong>titre</strong><br />";
$texte_html .= "votre texte <br />";
$texte_html .= "a ecrire ici <br />";
$mime_boundary = "----nomdusite----".md5(time());
$entetes = "From: nomdusite <services@nomdusite.org>\n";
$entetes .= "Mime-Version: 1.0\n";
$entetes .=
"Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n";
$entetes .= "X-Sender: <www.nomdusite.org>\n";
$entetes .= "X-Mailer: PHP/" . phpversion() . " \n" ;
$entetes .= "X-Priority: 3 (normal) \n";
$entetes .= "X-auth-smtp-user: services@nomdusite.org\n";
$entetes .= "X-abuse-contact: abuse@nomdusite.org\n";
$entetes .= "Importance: Normal\n";
$entetes .= "Reply-to: services@nomdusite.org\n";
// header texte plain
$mess = "--$mime_boundary\n";
$mess .= "Content-Type: text/plain; charset=ISO-8859-1\n";
$mess .= "Content-Transfer-Encoding: 8bit\n\n";
$mess .= $texte_plain;
// header texte en html
$mess .= "--$mime_boundary\n";
$mess .= "Content-Type: text/html; charset=ISO-8859-1\n";
$mess .= "Content-Transfer-Encoding: 8bit\n\n";
$mess .= $texte_html;
?>
Invité
04 Jan 2022 à 02:02Jai pas encore essayé mais merci deja pour le partage
Pc249
23 Avril 2009 à 21:45sauf erreur de ma part:
ne fonctionne pas avec des adresses "hotmail"
host mx3.hotmail.com[65.55.37.120] said: 550 SC-002
Mail rejected by Windows Live Hotmail for policy reasons. The mail server
IP connecting to Windows Live Hotmail has exhibited namespace mining
behavior. If you are not an email/network admin please contact your
E-mail/Internet Service Provider for help. Email/network admins, please
visit http://postmaster.live.com for email delivery information and support
(in reply to MAIL FROM command)