Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $email = '#^(([a-z0-9!\#$%&\\\'*+/=?^_`{|}~-]+\.?)*[a-z0-9!\#$%&\\\'*+/=?^_`{|}~-]+)@(([a-z0-9-_]+\.?)*[a-z0-9-_]+)\.[a-z]{2,}$#i';
- $lettre = '`^([a-zA-Zà áâãäåçèéêëìÃîïðòóôõöùúûüýÿ](\-| |\'|)){2,40}$`';
- require("class.phpmailer.php");
- if (isset($_POST["txtnom"])) {
- $mail = new PHPMailer();
- //$body = file_get_contents($_POST["messageArea"]);
- //$body = eregi_replace("[\]",'',$body);
- $mail->IsSMTP(); // set mailer to use SMTP
- try {
- $mail->Host = "smtp.live.com"; // smtp serveur
- $mail->SMTPDebug = 2;
- $mail->SMTPAuth = true;
- $mail->Host = "smtp.live.com"; // smtp serveur
- $mail->Port = 587;
- $mail->Username = "psyco78@hotmail.com";
- $mail->Password = "frederik78";
- $mail->AddAddress('psyco78@hotmail.com', 'Admin');
- $mail->SetFrom($_POST["txtemail"], $_POST["txtnom"]);
- $mail->MsgHTML($_POST["messageArea"]);
- $mail->SMTPSecure = "tls";
- $mail->Send();
- header("location: index.php?PagePhp=Contacter" );
- echo "Message envoyer<p></p>\n";
- } catch (phpmailerException $e) {
- echo $e->errorMessage(); //Pretty error messages from PHPMailer
- } catch (Exception $e) {
- echo $e->getMessage(); //Boring error messages from anything else!
- }
- }
- ?>
- <html>
- <head>
- <script type="text/javascript" src="jquery.js"></script>
- </head>
- <body>
- <div style="color: white; padding-top: 10px;">
- <div style="text-align: center; padding-bottom: 20px;">
- <h3>
- Contact
- </h3>
- Si vous avez des questions c'est la place pour le demander
- </div>
- <div>
- <form method="POST" name="email" onsubmit="return ValidationContanct()">
- <table align="center" >
- <tr>
- <td>
- <font color="white">Nom :</font>
- </td>
- <td>
- <input type="text" id="txtnom" name="txtnom" onkeypress="return ValidKeyPress(event)" maxlength="40"/>
- </td>
- <td>
- <?php
- if (!empty($_POST["txtnom"])) {
- $_POST["txtnom"] = htmlspecialchars($_POST["txtnom"]);
- if (!preg_match($lettre, $_POST["txtnom"])) {
- echo '<font color="Red">Pas de <strong>Chiffre</strong></font>';
- }
- }
- ?>
- </td>
- </tr>
- <tr>
- <td>
- <font color="white">Email :</font>
- </td>
- <td>
- <input type="text" ID="txtemail" name="txtemail" maxlength="255"/>
- </td>
- <td>
- <?php
- if (!empty($_POST["txtemail"])) {
- $_POST["txtemail"] = htmlspecialchars($_POST["txtemail"]);
- if (!preg_match($email, $_POST["txtemail"])) {
- echo '<font color="Red">Email non <strong>valide</strong></font>';
- }
- }
- ?>
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <font color="white">Message:</font>
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <textarea name="messageArea" cols="30" rows="10"></textarea>
- </td>
- </tr>
- <tr>
- <td colspan="2" align="right">
- <input type="submit" value="Valider"/>
- </td>
- </tr>
- </table>
- </form>
- </div>
- </div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment