Hello!

I'm trying to make a contact form so that user can give me feedback or questions, and the form should a mail send to me.

But no matter what I put in this mail() function, it returns false.

I already looked for a solution on this forum but I didn't manage to find something that'll do the trick...

Here is my php script :

PHP Code:
<?php
function Rec($text) {
   
$text trim($text); // delete white spaces after & before text
   
if (=== get_magic_quotes_gpc()) {
      
$stripslashes create_function('$txt''return stripslashes($txt);');
   } else {
      
$stripslashes create_function('$txt''return $txt;');
   }
   
//magic quotes ?
   
$text $stripslashes($text);
   
$text htmlspecialchars($textENT_QUOTES); // converts to string with " and ' as well
   
$text nl2br($text);
   return 
$text;
};

// my e-mail address (I want the mail to be sent in) (his is not aname...)
$destinataire 'aname@gmail.com';
// I found this somewhere but still not working
ini_set('sendmail_from''contact@myx10domain.x10.mx');

// French confirmation messages (meesage send) (message not send)
$message_envoye "Votre message nous est bien parvenu!";
$message_non_envoye "L'envoi du mail a échoué, le serveur rencontre peut être une panne temporaire.";

$nom     = (isset($_POST['nom']))     ? Rec($_POST['nom'])     : '';
$email   = (isset($_POST['email']))   ? Rec($_POST['email'])   : '';
$sujet   = (isset($_POST['sujet']))   ? Rec($_POST['sujet'])   : '';
$message = (isset($_POST['message'])) ? Rec($_POST['message']) : '';

if ((
$nom != '') && ($email != '') && ($sujet != '') && ($message != '')) {
   
// name, email, subject and message are not empty
   
$headers 'From: '.$nom.' <'.$email.'>' "\r\n";

    
$cible $destinataire;

   
// Special chars replacement
   
$message html_entity_decode($message);
   
$message str_replace(''',"'",$message);
   
$message = str_replace('’',"'",$message);
   $message = str_replace('
<br>','',$message);
   $message = str_replace('
<br />','',$message);

   // Sending mail...
   if (mail($cible, $sujet, $message, $headers)) {
    echo '
<p>'.$message_envoye.'</p>'."\n";
   } else {
    echo '
<p>'.$message_non_envoye.'</p>'."\n";
} else {
    echo '
<p>'."Le formulaire a été mal rempli!".'</p>'."\n";
}
?>
Thank you in advance for your help!