PHP sending form doesn't work correctly
<p>I'm testing a PHP form to send email in local.</p>

<p>I put all input but when I press the submit button it always returns "false" and then the error message. Is that because I'm working in local and don't have any mail server, or is there something wrong in my code?</p>

<p>here the code:</p>

<pre><code>&lt;?php
    if(isset($_POST['submit']))
    {
        if(empty($_POST['nome'])      ||
           empty($_POST['email'])     ||
           empty($_POST['motivo'])     ||
           empty($_POST['messaggio'])   ||
           !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
           {
           echo "No arguments Provided!";
           // return false;
           }
        else
            {

                $nome = strip_tags(htmlspecialchars($_POST['nome']));
                $email_address = strip_tags(htmlspecialchars($_POST['email']));
                $motivo = strip_tags(htmlspecialchars($_POST['motivo']));
                $messaggio = strip_tags(htmlspecialchars($_POST['messaggio']));

                // Create the email and send the message
                $to = 'mirkocoppola80@gmail.com'; // Add your email address inbetween the '' replacing yourname@yourdomain.com - This is where the form will send a message to.
                $email_subject = "Website Contact Form:  $nome";
                $email_body = "You have received a new message from your website contact form.\n\n"."Here are the details:\n\nName: $nome\n\nEmail: $email_address\n\nOggetto: $motivo\n\nMessaggio:\n$messaggio";
                $headers = "From: mirkocoppola80@gmail.com\n"; // This is the email address the generated message will be from. We recommend using something like noreply@yourdomain.com.
                $headers .= "Reply-To: $email_address";
                if (!@mail($to,$email_subject,$email_body,$headers))
                    {
                    // return true;
                        echo "&lt;p&gt;Email error&lt;/p&gt;";
                    }
                    else
                    {
                        echo "&lt;p&gt;Email sent successfully!&lt;/p&gt;";
                    }
            }
    }
    ?&gt;
    &lt;form class="form-horizontal col-sm-6 col-sm-offset-3" action="&lt;?php echo htmlentities($_SERVER['PHP_SELF']); ?&gt;" method="POST"&gt;
      &lt;div class="form-group"&gt;
        &lt;div class="row"&gt;
          &lt;label for="email" class="col-sm-12"&gt;Email&lt;/label&gt;
        &lt;/div&gt;
        &lt;div class="row"&gt;
          &lt;div class="col-sm-12"&gt;
            &lt;input type="email" name="email" class="form-control" id="email" placeholder="Email"&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
        &lt;div class="row"&gt;
          &lt;label for="nome" class="col-sm-12"&gt;Nome&lt;/label&gt;
        &lt;/div&gt;
        &lt;div class="row"&gt;
          &lt;div class="col-sm-12"&gt;
            &lt;input type="text" name="nome" class="form-control" id="nome" placeholder="Nome"&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
        &lt;div class="row"&gt;
          &lt;label for="motivo" class="col-sm-12"&gt;Motivo&lt;/label&gt;
        &lt;/div&gt;
        &lt;div class="row"&gt;
          &lt;div class="col-sm-12"&gt;
            &lt;input type="text" name="motivo" class="form-control" id="motivo" placeholder="Motivo"&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
        &lt;div class="row"&gt;
          &lt;label for="messaggio" class="col-sm-12"&gt;Messaggio&lt;/label&gt;
        &lt;/div&gt;
        &lt;div class="row"&gt;
          &lt;div class="col-sm-12"&gt;
            &lt;textarea class="form-control" name="messaggio" rows="5" id="messaggio" placeholder="Motivo"&gt;Inserisci il tuo messaggio...&lt;/textarea&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
        &lt;div class=""&gt;
          &lt;button type="submit" name="submit" class="btn btn-default"&gt;Invia&lt;/button&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/form&gt;
</code></pre>

<p>Any help?</p>