le fichier version1.php
Code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
<b>Inscrivez vous sur notre Newsletter</b>
<form method="post" action="http://clubsalon.net/mail1.php" >
<div>
<span>Votre Nom :
<input type="text" name="nom" size="30"/></span>
<br/>
<span>Votre Email :
<input type="text" name="email" size="30"/></span>
<br/><br/>
<input type="submit" value="envoyer"/>
<input type="submit" value="désinscription"/></div>
</form> |
le fichier mail1.php
Code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
<?php
$mail="MA BOITE MAIL"; // Déclaration de l'adresse de destination.
if (!preg_match("#^[a-z0-9._-]+@(hotmail|live|msn).[a-z]{2,4}$#", $mail)) // On filtre les serveurs qui rencontrent des bogues.
{
$passage_ligne = "\r\n";
}
else
{
$passage_ligne = "\n";
}
$nom=$_POST['nom'];
$email=$_POST['email']
//=====Déclaration des messages au format texte et au format HTML.
$message_txt = "Salut à tous, voici un e-mail envoyé par un script PHP.";
$message_html="
Nom:$nom <br />
email:$email <br/>;
//==========
//=====Création de la boundary
$boundary = "-----=".md5(rand());
//==========
//=====Définition du sujet.
$sujet = "Inscription a la Newsletter !";
//=========
//=====Création du header de l'e-mail.
$header = "From: \"Me\"<MA BOITE MAIL>".$passage_ligne;
$header.= "Reply-to: \"Me\" <MA BOITE MAIL>".$passage_ligne;
$header.= "MIME-Version: 1.0".$passage_ligne;
$header.= "Content-Type: multipart/alternative;".$passage_ligne." boundary=\"$boundary\"".$passage_ligne;
//==========
//=====Création du message.
$message = $passage_ligne.$boundary.$passage_ligne;
//=====Ajout du message au format texte.
$message.= "Content-Type: text/plain; charset=\"ISO-8859-1\"".$passage_ligne;
$message.= "Content-Transfer-Encoding: 8bit".$passage_ligne;
$message.= $passage_ligne.$message_txt.$passage_ligne;
//==========
$message.= $passage_ligne."--".$boundary.$passage_ligne;
//=====Ajout du message au format HTML
$message.= "Content-Type: text/html; charset=\"ISO-8859-1\"".$passage_ligne;
$message.= "Content-Transfer-Encoding: 8bit".$passage_ligne;
$message.= $passage_ligne.$message_html.$passage_ligne;
//==========
$message.= $passage_ligne."--".$boundary."--".$passage_ligne;
$message.= $passage_ligne."--".$boundary."--".$passage_ligne;
//==========
//=====Envoi de l'e-mail.
mail($mail,$sujet,$message,$header);
//==========
echo '<script>alert("Votre inscription à bien été pris en compte,merci");window.location.replace("http://clubsalon.net")</script>';
?> |
~ LE echo ne fonctionne pas .
Code :
echo '<script>alert("Votre inscription à bien été pris en compte,merci");window.location.replace("http://clubsalon.net")</script>';
~
MERCI