| CODE |
| <?php if(isset($_POST["nom"])) { $email="mon_email@gmail.com"; $nom=htmlentities($_POST["nom"], ENT_QUOTES); $mess=htmlentities($_POST["mess"], ENT_QUOTES); //********* l'e-mail /* subject */ $subject = "Formulaire"; /* message */ $message = ' <html> <head> <title>Formulaire</title> </head> <body> Nom : '.$nom.'<br><br> Message : '.$mess.'<br><br> </body> </html> '; /* To send HTML mail, you can set the Content-type header. */ $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; /* additional headers */ $headers .= "To: moi <'.$email.'>\r\n"; $headers .= "From: monSite <do_not_reply@free.fr>\r\n"; /* and now mail it */ if(mail($email, $subject, $message, $headers)) { echo 'Votre e-mail a bien été envoyé, nous vous répondrons dès que possible.'; } else {echo 'We weren't able to send you the confirmation e-mail. Please contact the webmaster.<br/>';} } else echo '<form action="'.$_SERVER["PHP_SELF"].'" method="post"> <table> <tr> <td>Nom :</td><td><input type="text" name="nom" size="50" maxlength="20" /></td> </tr> <tr> <td>Message :</td><td><textarea name="mess" rows="10" cols="50"></textarea></td> </tr> </table> <input type="submit" value=" Envoyer " /> </form>'; ?> |