<?php $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $to = "[email protected]"; $subject = "Hello"; $body = "You have received a message from " . $name . " (" . $email . "):\n\n" . $message; $from = "From:"; $headers = "From:" . $from . "\r\n"; $headers .= "Reply-To: " . $from . "\r\n"; $headers .= "X-Mailer: PHP/" . phpversion(); if (filter_var($email, FILTER_VALIDATE_EMAIL)) { if ($name != '' && $email != '' && $message != '') { if (mail ($to, $subject, $body, $headers)) { echo '<p style="color:#66A325;">Thanks! Your message has been sent.</p>'; } else { echo '<p style="color:#F84B3C;">Something went wrong, go back and try again!</p>'; } } else { echo '<p style="color:#F84B3C;">You need to fill in all required fields!</p>'; } } else { echo '<p style="color:#F84B3C;">Invalid Email, please provide an correct email.</p>'; } ------------------------------------------------------------------------------- **Lo llamo desde el formulario** <!-- begin snippet: js hide: false --> <!-- language: lang-html --> <form id="contact-form" [![introducir la descripción de la imagen aquí][1]][1] method="post" action="contact.php"> <input type="text" name="name" placeholder="Nombre"> <input type="email" name="email" placeholder="Email"> <textarea name="message" placeholder=" Escriba su comentario.></textarea> <input type="button" value="Enviar Mensaje"> <input type="reset" value="Reestablecer los campos"> </form> <!-- end snippet --> **y js** <script> $(document).ready(function(){ $('#send').click(function(){ $(this).val('Enviando ...'); $('#success p').remove(); $.post('contact.php', $('#contact-form').serialize(), function(response) { $('#success').html(response); //$('#success').hide('slow'); $('#send').val('Enviar Mensaje'); }); return false; }); }); </script> **error es** Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\contact.php on line 22 [1]: https://i.sstatic.net/0TmUG.jpg