Se supone que tiene que salir el mail de la persona que me lo envia pero me sale
World wide Web Owner - [email protected]
Me podeis decir que pasa. No veo el error.
Código PHP:
<?php
// Do not edit this if you are not familiar with php
error_reporting (E_ALL ^ E_NOTICE);
$post = (!empty($_POST)) ? true : false;
include 'contact-options.php';
if($post){
function ValidateEmail($email){
$regex = "([a-z0-9_\.\-]+)". # name
"@". # at
"([a-z0-9\.\-]+){2,255}". # domain & possibly subdomains
"\.". # period
"([a-z]+){2,10}"; # domain extension
$eregi = eregi_replace($regex, '', $email);
return empty($eregi) ? true : false;
}
$name = stripslashes($_POST['name']);
$email = trim($_POST['email']);
$subject = stripslashes($_POST['subject']);
$message = stripslashes($_POST['message']);
$phone = stripslashes($_POST['phone']);
$answer = trim($_POST['answer']);
$verificationanswer="3"; // plz change edit your human answer
$to= $replyto; //$toemail.','.$replyto;
$error = '';
$headers="";
//$headers.="Reply-to:$replyto\n";
$headers .= "From: $email\n";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers = "Content-Type: text/html; charset=iso-8859-1\n".$headers;
// Checks Name Field
if(!$name)
{
$error .= 'Please enter your name.<br />';
}
// Checks Email Field
if(!$email)
{
$error .= 'Please enter an e-mail address.<br />';
}
if($email && !ValidateEmail($email))
{
$error .= 'Please enter a valid e-mail address.<br />';
}
// Checks Subject Field
if(!$subject)
{
$error .= 'Please enter your subject.<br />';
}
if( $answer <> $verificationanswer)
{
$error .= 'Please enter the Correct verification number.<br />';
}
// Checks Message (length)
if(!$message || strlen($message) < 5)
{
$error .= "Please enter your message. It should have at least 5 characters.<br />";
}
if(!$error){
$messages="From: $name <br>";
//$messages.="Name: $name <br>";
$messages.="Email: $email <br>";
if($phone){
$messages.="Phone: $phone <br>";
}
$messages.="Message: $message <br>";
$mail = mail($to,$subject,$messages,$headers);
if($mail){ echo 'OK'; }
} else { echo '<div class="error">'.$error.'</div>'; }
}
?>
Código PHP:
<?php
// Change the Email Addresses below to email Id where you want to get your emails.
// Reply Email Address where you want to set reply to email ID
$replyto='[email protected], [email protected]';
$uploadpath='/temp/';
$save_path ='http://'.$_SERVER['SERVER_NAME'].$uploadpath; // do not change this
$toemail='[email protected]';
/*
switch ($subject) {
case "Informacion": // appears as subject in mail and select field name 1 in form
$toemail='[email protected]'; // select field email 1
break;
case "Contratacion": // appears as subject in mail and select field name 3 in form
$toemail='[email protected]'; // select field email 2
break;
}
*/
//$autorespond="no"; // no : Disable the Auto-Responder yes : Enable Auto-Responder.
?>
Código Javascript:
Ver original
/* contact form */ $(document).ready(function() { $("#contact-form").submit(function() { $('#load').append('<center><img src="i/ajax-load.gif" alt="Currently Loading" id="loading" /></center>'); var fem = $(this).serialize(), note = $('#note'); $.ajax({ type: "POST", url: "contactform/contact.php", data: fem, success: function(msg) { if ( note.height() ) { note.slideUp(1000, function() { $(this).hide(); }); } else note.hide(); $('#loading').fadeOut(300, function() { $(this).remove(); // Message Sent? Show the 'Thank You' message and hide the form result = (msg === 'OK') ? '<div class="success">Your message has been sent. Thank you!</div>' : msg; var i = setInterval(function() { if ( !note.is(':visible') ) { note.html(result).slideDown(1000); clearInterval(i); } }, 40); }); // end loading image fadeOut } }); return false; }); /* fin contact form */ });