ciao a tutti,
ho un problema con la funzione mail, la funzione non ritorna errore, ma la mail non arriva o non viene spedita, cè qualcosa che devo controllare?
ho letto la pillola e so che bisogna cambiare il file php.ini, ma sto facendo girare il sito in locale (http://localhost/...)
devo cambiarlo lo stesso?come dovrebbe essere questo file nel mio caso?!

vi posto il codice, magari cè comunque qualche errore qui, non so...

Codice PHP:
<h1>Password lost</h1>
                  
                  <form name="adduser" method="post" action="lostpassword.php">
                      

Insert your username 

                      <input type="text" name="username" /></p>
                      

<input type="submit" name="Submit" value="Submit" align="center" /></p>
                   </form>
                   <?       
                  
//define the receiver of the mail
                  
$user$_POST['username'];
                  
$sql"SELECT * FROM user WHERE username='".$user."'";
                  
$result mysql_query($sql$connection)
                                      or die(
"Couldn't perform query $sql </br>".mysql_error());
                  
$row mysql_fetch_array($result);
                  if(
$row == null){
                      echo 
"error";
                  }
                  
$to $row['email'];
                  
//define the subject of the email
                  
$subject 'Password';
                  
//define the message to be sent. Each line should be separated with \n
                  
$message "This mail is automatically generated.\nThe new password for the SOUND OFF Forum is password, you should change this password once logged in into the system\r\n";
                  
//define the headers we want passed. Note that they are separated with \r\n
                  
$headers "From: admin-sound off-forum\r\nDo not reply to this email";
                  
//send the email
                  //$mail_sent = mail( $to, $subject, $message, $headers );
                  
$mail_sent mail$to$subject$message );
                  
//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" 
                  //echo $mail_sent ? "Mail sent" : "Mail failed";
                  
                  //set the default password as the password of the user
                  
$cryptedpwd=md5('password');
                  
$sql="UPDATE user SET password='".$cryptedpwd."' WHERE username= '".$user."'";
                  
$result mysql_query($sql$connection)
                                      or die(
"Couldn't perform query $sql </br>".mysql_error());
                  
                  if (
$mail_sent) {
                      echo 
"

Message successfully sent to"
.$row['email']."</p>";
                  } else {
                  echo 
"

Message delivery failed...</p>"
;
                  }
                }
                if (
$lostinfo=="username"){
                
?>
spero mi sappiate dare qualche dritta perchè mi sono bloccata su questa e un altra cosa e non riesco proprio ad andare avanti!