Bonjour, je débute en php et là j'ai un problème de formulaire sur un site hébergé chez one.com (PHP 7.3). Le message formulaire envoyé s'affiche bien mais je ne reçois rien. Problème de code ? de configuration PHP ? Ou il manque un truc ?
Merci de votre aide.
Le formulaire :
Le code du fichier mailer.php
Vous avez une idée ?
Merci de votre aide.
Le formulaire :
<div class="row">
<div class="col-md-8 col-sm-12 contact_content_left">
<div class="content_big_title">
Consultation <span class="text_color">en ligne</span>
</div>
<div class="contact_small_text">
Merci de décrire l'objet de votre demande.<br/>
Envoyez vos documents et photos au format PDF ou JPG par <a href="https://wetransfer.com/"><u>WeTransfer</u></a> ou <a href="http://www.dropbox.com"><u>Dropbox</u></a>.
</div>
<form name="contact_form" method="post" action="" class="contact_form">
<div class="row">
<div class="col-md-6 col-sm-12">
<input type="text" class="contact_form_name" name="name" id="name" placeholder="Votre nom *" required/>
</div>
<div class="col-md-6 col-sm-12">
<input type="text" class="contact_form_surname" name="surname" id="surname" placeholder="Votre prénom *" required/>
</div>
</div>
<div class="row">
<div class="col-md-6 col-sm-12">
<input type="email" class="contact_form_email" name="email" id="email" placeholder="Votre email *" required/>
</div>
<div class="col-md-6 col-sm-12">
<input type="phone" class="contact_form_phone" name="phone" id="phone" placeholder="Votre téléphone *" required/>
</div>
</div>
<div class="contact_small_text">
Adresse de la construction :
</div>
<div class="row">
<div class="col-md-6 col-sm-12">
<input type="text" class="contact_form_address" name="rue" id="rue" placeholder="Rue *" required/>
</div>
<div class="col-md-6 col-sm-12">
<input type="text" class="contact_form_address" name="cplt" id="cplt" placeholder="Complément d'adresse"/>
</div>
</div>
<div class="row">
<div class="col-md-6 col-sm-12">
<input type="text" class="contact_form_address" name="zip" id="zip" placeholder="Code postal *" required/>
</div>
<div class="col-md-6 col-sm-12">
<input type="text" class="contact_form_address" name="ville" id="ville" placeholder="Ville *" required/>
</div>
</div>
<div class="row">
<div class="col-md-6 col-sm-12">
<input type="text" class="contact_form_address" name="dpt" id="dpt" placeholder="Département *" required/>
</div>
<div class="col-md-6 col-sm-12">
<input type="text" class="contact_form_address" name="pays" id="pays" placeholder="Pays *" required/>
</div>
</div>
<div class="contact_small_text">
Votre adresse :
</div>
<div class="row">
<div class="col-md-6 col-sm-12">
<input type="text" class="contact_form_address" name="rue" id="rue" placeholder="Rue *" required/>
</div>
<div class="col-md-6 col-sm-12">
<input type="text" class="contact_form_address" name="cplt" id="cplt" placeholder="Complément d'adresse"/>
</div>
</div>
<div class="row">
<div class="col-md-6 col-sm-12">
<input type="text" class="contact_form_address" name="zip" id="zip" placeholder="Code postal *" required/>
</div>
<div class="col-md-6 col-sm-12">
<input type="text" class="contact_form_address" name="ville" id="ville" placeholder="Ville *" required/>
</div>
</div>
<div class="row">
<div class="col-md-6 col-sm-12">
<input type="text" class="contact_form_address" name="dpt" id="dpt" placeholder="Département *" required/>
</div>
<div class="col-md-6 col-sm-12">
<input type="text" class="contact_form_address" name="pays" id="pays" placeholder="Pays *" required/>
</div>
</div>
<div class="contact_small_text">
Description de votre demande :
</div>
<div class="contact_form_message_block">
<textarea name="message" id="message" placeholder="Votre Message" class="contact_form_message" required></textarea>
</div>
<div class="contact_form_btn_block">
<input type="submit" value="Envoyer" class="contact_form_bnt contact_btn"/>
<input type="reset" value="Tout Effacer" class="contact_form_bnt "/>
</div>
</form>
</div>
Le code du fichier mailer.php
<?php
// Define some constants
define( "RECIPIENT_NAME", "Test" );
define( "RECIPIENT_EMAIL", "bla-bla-test@gmail.com" );
define( "EMAIL_SUBJECT", "Contact site" );
// Read the form values
$success = false;
$senderName = isset( $_POST['name'] ) ? preg_replace( "/[^\.\-\' a-zA-Z0-9]/", "", $_POST['name'] ) : "";
$senderEmail = isset( $_POST['email'] ) ? preg_replace( "/[^\.\-\_\@a-zA-Z0-9]/", "", $_POST['email'] ) : "";
$message = isset( $_POST['message'] ) ? preg_replace( "/(From:|To:|BCC:|CC:|Subject:|Content-Type:)/", "", $_POST['message'] ) : "";
//Send Email
$recipient = RECIPIENT_NAME . " <" . RECIPIENT_EMAIL . ">";
$headers = "From: " . $senderName . " <" . $senderEmail . ">";
$success = mail( $recipient, EMAIL_SUBJECT, $message, $headers );
Vous avez une idée ?