I am trying to send a mail from a html form. I am working with a localhost. I can't send the email but it doesn't show the error. What can I do to see the error? Thank you for your time.

if ($_POST['submit'])
{ 	$nume=$_POST['nume_exp'];
if ($nume && $mesaj)
		ini_set('display_errors', true);
		$to = 'cristina.horjea@yahoo.com';                 // Adresa unde va fi trimis mesajul 
    $subiect = 'Mesaj de pe site'; 
    $mesaj = $_POST['mesaj']; 
    $from = 'From: '. $_POST['mail_exp']; 
		if (@mail($to, $subiect, $mesaj, $from))
			 { echo 'Mesajul a fost trimis cu succes.'; 
    	else {  echo 'Eroare, mesajul nu a putut fi expediat.'; }
else die("Nu ati introdus valori in toate campurile");

<form method="post" action="contact.php">
				<td><input type="text" name="nume_exp" size="25"></td>
				<td><input type="text" name="prenume_exp" size="25"></td>
				<td>ADRESA EMAIL:</td>
				<td><input type="text" name="mail_exp" size="25"></td>
				<td><textarea name="mesaj" cols="25" rows="8"></textarea></td>
				<td colspan="2" align="center">
					<input type="reset" value="Anuleaza"/>
					<input type="submit" name="submit" value="Trimite"/>

It is possible you have not specified a email from which it can be sent, check php.ini at the section of mail options. This problem does not occur on servers, because on most servers the server also has a mail-server.


just to remind you... you cant directly use the php mail function without first having an installed and working email system

Your if..else statements shows the message that you have. If you want to see the actual error message leave the else part (or) remove the condition and execute it directly then you will see the warning or error messages.

I found out that mail() function did not work on some web hosting provider. I don't know why, but I experienced it couple of years ago.

I use PHPMailer class till now. It rocks.