Bonjour,
J'ai un soucis concernant l'envoi de mon formulaire sur une adresse e-mail.
Je vous montre mon code :
PHP:
Formulaire:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <?php function adresse_ok($mail) // V�rifie l�adresse mail { if (!preg_match("#^[a-z0-9._-]+@(hotmail|live|msn).[a-z]{2,4}$#", $mail)) { return false; } else { return true; } } if ((isset ($_POST['prenom'])) && (isset ($_POST['nom'])) && (isset ($_POST['email'])) && (isset ($_POST['message'])) ) { if(adresse_ok($_POST['email'])) { $nom = htmlspecialchars (mysql_real_escape_string ($_POST['nom'])); $prenom = htmlspecialchars (mysql_real_escape_string ($_POST['prenom'])); $email = htmlspecialchars (mysql_real_escape_string ($_POST['email'])); $message = htmlspecialchars (mysql_real_escape_string ($_POST['message'])); if (!preg_match("#^[a-z0-9._-]+@(hotmail|live|msn).[a-z]{2,4}$#",$email)) // gestion retour a la ligne dans le mail envoyer (prob microsoft) { $retour_a_la_ligne="\r\n"; } else { $retour_a_la_ligne="\n"; } $headers = 'From : '. $prenom .' '. $nom .'<'.$email.'>'.$retour_a_la_ligne; $headers.= 'Content-Type: text/plain; charset="iso-8859-1"'.$retour_a_la_ligne; $headers.= 'Content-Transfer-Encoding: 8bit'; $titre = 'Question du client'; //------------------------------------------------- // CONFIGURATION DE L'ADRESSE MAIL !!!!!' //------------------------------------------------- mail("moi@email.com",$titre,$message,$headers); } } ?>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <form method="post" action="contact.php" id="formulaire_contact"> <table> <h4><u> Me contacter : </u></h4> <tr> <th>Votre prenom</th> <td><input type="text" name="prenom" maxlength="25"/></td> </tr> <tr> <th>Votre nom</th> <td><input type="text" name="nom" maxlength="25"/></td> </tr> <tr> <th>Votre mail</th> <td><input type="text" name="email" maxlength="60"/></td> </tr> <tr> <th>Votre message</th> <td> <textarea name="message" cols="30" rows="10"> </textarea> </td> </tr> </table> <input type="submit" value="Envoyer votre mail"/> <input name="annuler" type="reset" value="Effacer"/> </form>
Merci beaucoup pour votre aide
cordialement,
Arsenik
Partager