Bonjour,
J'ai récupéré le code d'un ami pour traiter les données d'un formulaire de contact et envoyer ces informations sur ma boite gmail, mais ça n'a pas l'air de marcher
étant débutant, je m'adresse à vous pour essayer de régler ce problème...
Voici le code du fichier traitement.php :
et voici le code html du formulaire
J'ai récupéré le code d'un ami pour traiter les données d'un formulaire de contact et envoyer ces informations sur ma boite gmail, mais ça n'a pas l'air de marcher

Voici le code du fichier traitement.php :
<?php
if( isset($_POST['nom']) && !empty($_POST['nom']) ) $nom = htmlspecialchars($_POST['nom'], ENT_QUOTES);
else $nom = '';
if( isset($_POST['email']) && !empty($_POST['email']) ) $email = htmlspecialchars($_POST['email'], ENT_QUOTES);
else $email = '';
if( isset($_POST['comments']) && !empty($_POST['comments']) ) $comments = htmlspecialchars($_POST['comments'], ENT_QUOTES);
else $comments = '';
if( $nom !== '' && $email !=="" && comments !== ""){
//-----------------------------------------------
//DECLARE LES VARIABLES
//-----------------------------------------------
$destinataire = 'nd.delaye@gmail.com';
$subject = 'Contact à partir du site';
$email_reply = 'nd.delaye@gmail.com';
$email_expediteur = 'nd.delaye@gmail.com';
$message_html = '<html>
<body>
<h2>De la part de '.$nom.' '.$email.'</h2><br />
<br />
'.$comments.'
</body>
</html>';
//-----------------------------------------------
//HEADERS DU MAIL
//-----------------------------------------------
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/html; charset=UTF-8\n";
$headers .= "Content-Transfer-Encoding: 8bit\n";
$headers .= "From: NicolasDelaye.com <nd.delaye@gmail.com>\r\n";
$headers .= 'Return-Path: <'.$email_expediteur.'>'."\n";
//-----------------------------------------------
//MESSAGE HTML
//-----------------------------------------------
$message = $message_html;
if(mail($destinataire,$subject,$message,$headers)) {
$smarty->assign('envoiemail','1');
}
}
?>
et voici le code html du formulaire
<a name="contact"></a>
{if isset($envoiemail) && $envoiemail == "1"}
<span style="color:#F00">Votre email a été envoyé</span>
{/if}
<div id="form">
<div id="field">
<form id="formID" class="formular" method="post" action="#contact" enctype="application/x-www-form-urlencoded">
<table>
<tbody>
<tr><td><label>Nom</label></td></tr>
<tr><td> <input class="validate[required,custom[onlyLetter],length[0,100]]" type="text" name="nom" id="nom" /></td></tr>
<tr><td><label>E-mail</label></td></tr>
<tr><td><input class="validate[required,custom[email]]" type="text" name="email" id="email" /></td></tr>
<tr><td> <label>Message</label></td></tr>
<tr><td><textarea class="validate[required,length[6,300]]" name="comments" id="comments" rows="5" cols="5"></textarea></td></tr>
<tr><td><input class="submit" value="Valider" type="submit" /></td></tr>
</tbody>
</table>
</form>
</div>
</div>