Ver Mensaje Individual
  #5 (permalink)  
Antiguo 21/06/2010, 10:17
Avatar de Marvin
Marvin
Colaborador
 
Fecha de Ingreso: febrero-2005
Ubicación: global $Chile->Santiago;
Mensajes: 1.991
Antigüedad: 21 años, 7 meses
Puntos: 81
Respuesta: E-mail form que funcione CARAY!

Prueba con:
Código PHP:
<?php

/************************
* Variables you can change
*************************/

$mailto = "[email protected]";
$cc = "";
$bcc = "";
$subject = "From your Website";
$vname = "";


/************************
* do not modify anything below unless you know PHP/HTML/XHTML
*************************/
$email = $_POST['email'];
function 
validateEmail($email){
    if(
eregi('^[A-Z, a-z, 0-9._-]+@[A-Z, a-z, 0-9-]+\.[A-Z, a-z, 0-9]{2,4}(\.[A-Z, a-z, 0-9]{2,3})?(\.[A-Z, a-z, 0-9]{2,3})?$', $email))
        return 
true;
    else
        return 
false;
}

if((
strlen($_POST['name']) < 1 ) || (strlen($email) < 1 ) || (strlen($_POST['message']) < 1 ) || validateEmail($email) == false){
    
$emailerror .= '';
    if(
strlen($_POST['name']) < 1 ){ $emailerror .= '<li>Enter name</li>'; }
    if(
strlen($email) < 1 ){ $emailerror .= '<li>Enter email</li>'; }
    if(
validateEmail($email) == false){ $emailerror .= '<li>Enter valid email</li>'; }
    if(
strlen($_POST['message']) < 1 ){ $emailerror .= '<li>Enter message</li>'; }
}else{
    
$emailerror .= "Your email has been sent successfully";
    
$headers  = 'MIME-Version: 1.0' . "\r\n";
    
$headers .= 'From: "'.$vname.'" <'.$_POST['e_mail'].'>'."\r\n";
    
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    
$headers .= 'Reply-To: "'.ucwords($_POST['vname']).'" <'.$_POST['e_mail'].'>'."\r\n";
    
$headers .= 'Cc: '.$cc . "\r\n";
    
$headers .= 'Bcc: '.$bcc . "\r\n";
    
    
    
// NOW SEND THE ENQUIRY
    
$timestamp = date("F j, Y, g:ia");
    
$messageproper = "\r\nName: ".ucwords($_POST['name'])."
    \r\nEmail: "
.ucwords($email)."
    \r\nWebsite: "
.ucwords($_POST['website'])."
    \r\nCompany: "
.ucwords($_POST['company'])."
    \r\nComments: "
.$_POST['message']."\r\n";
    
$messageproper = trim(stripslashes($messageproper));
    
mail($mailto, $subject, $messageproper,$headers);
}
?>
<div id='emailerror'>
    <ul>
        <?php echo $emailerror; ?>
    </ul>
</div>
Suerte!
__________________
El que dice "Solo sé que nada sé", esta asumiendo que sabe algo.
Lea las FAQ's!