F
fabriig2
Alfa
Usuário com poucas negociações! Use sempre o saldo do ForoBeta!
Hola, que tal? Como andan? Porfavor alguien podria ayudarme en mi formulario de contacto? Al enviar un mensaje me da error y no se envia al email que puse!
En el archivo sendmail.php puse el siguiente codigo:
Y en el archivo index.php tengo el siguiente codigo:
En el archivo sendmail.php puse el siguiente codigo:
HTML:
<?php
//we need to get our variables first
$email_to = 'kobic@hotmail.com'; //the address to which the email will be sent
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
/*the $header variable is for the additional headers in the mail function,
we are asigning 2 values, first one is FROM and the second one is REPLY-TO.
That way when we want to reply the email gmail(or yahoo or hotmail...) will know
who are we replying to. */
$headers = "From: $email\r\n";
$headers .= "Reply-To: $email\r\n";
if(mail($email_to, $subject, $message, $headers)){
echo 'sent'; // we are sending this text to the ajax request telling it that the mail is sent..
}else{
echo 'failed';// ... or this one to tell it that it wasn't sent
}
?>
Y en el archivo index.php tengo el siguiente codigo:
HTML:
<!-- Contact Form -->
<div class="contact-form col-md-6 wow fadeInUp" data-wow-duration="500ms" data-wow-delay="300ms">
<form id="contact-form" method="post" action="sendmail.php" role="form">
<div class="form-group">
<input type="text" placeholder="nombre" class="form-control" name="name" id="name">
</div>
<div class="form-group">
<input type="email" placeholder="Email" class="form-control" name="email" id="email">
</div>
<div class="form-group">
<input type="text" placeholder="tema" class="form-control" name="subject" id="subject">
</div>
<div class="form-group">
<textarea rows="6" placeholder="Mensaje" class="form-control" name="message" id="message"></textarea>
</div>
<div id="mail-success" class="success">
Mensaje Enviado!
</div>
<div id="mail-fail" class="error">
Reintenta Nuevamente!
</div>
<div id="cf-submit">
<input type="submit" id="contact-submit" class="btn btn-transparent" value="ENVIAR">
</div>
</form>
</div>
<!-- ./End Contact Form -->