Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/06/2011, 07:25
Avatar de 23r9i0
23r9i0
 
Fecha de Ingreso: noviembre-2008
Ubicación: Catalonia
Mensajes: 203
Antigüedad: 15 años, 5 meses
Puntos: 33
Problema con remitente en formulario

Hola tengo un problema con el remitente al enviar el mensaje.
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>'; }

}
?>
y en contact-options
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.

?>
y por si lo necesitais el js
Código Javascript:
Ver original
  1. /* contact form */
  2. $(document).ready(function() {
  3.     $("#contact-form").submit(function() {
  4.         $('#load').append('<center><img src="i/ajax-load.gif" alt="Currently Loading" id="loading" /></center>');
  5.  
  6.         var fem = $(this).serialize(),
  7.             note = $('#note');
  8.    
  9.         $.ajax({
  10.             type: "POST",
  11.             url: "contactform/contact.php",
  12.             data: fem,
  13.             success: function(msg) {
  14.                 if ( note.height() ) {         
  15.                     note.slideUp(1000, function() { $(this).hide(); });
  16.                 }
  17.                 else note.hide();
  18.  
  19.                 $('#loading').fadeOut(300, function() {
  20.                     $(this).remove();
  21.  
  22.                     // Message Sent? Show the 'Thank You' message and hide the form
  23.                     result = (msg === 'OK') ? '<div class="success">Your message has been sent. Thank you!</div>' : msg;
  24.  
  25.                     var i = setInterval(function() {
  26.                         if ( !note.is(':visible') ) {
  27.                             note.html(result).slideDown(1000);
  28.                             clearInterval(i);
  29.                         }
  30.                     }, 40);    
  31.                 }); // end loading image fadeOut
  32.             }
  33.         });
  34.  
  35.         return false;
  36.     });
  37.     /* fin contact form */
  38. });