Ver Mensaje Individual
  #4 (permalink)  
Antiguo 22/07/2013, 15:43
bullanguero8
 
Fecha de Ingreso: junio-2013
Ubicación: santiago
Mensajes: 34
Antigüedad: 10 años, 11 meses
Puntos: 0
Respuesta: problemas con funcion mail

Aqui te mando un codigo facil y que funciona, espero te sirva

Cita:
<form action="enviar.php" method="post" id="ContactForm">
<div>
<div class="wrapper">
<span>*Nombre:</span>
<input name="Nombre" type="text" required class="col1" id="Nombre" maxlength="60">
</div>
<div class="wrapper">
<span>Empresa:</span>
<input name="Empresa" type="text" class="col1" id="Empresa" maxlength="50">
</div>
<div class="wrapper">
<span>*motivo:</span>
<input name="motivo" type="text" class="col1" id="motivo" maxlength="50">
</div>
<div class="wrapper">
<span>*Telefono</span>
<input type="tel" id="telefono" name="telefono" size="6" maxlength=9 pattern="[0-9]{6}" class="col1" placeholder="celular y telefono fijo">
</div>
<div class="wrapper">
<span>E-mail</span>
<input type="email" id="mail" name="mail" required class="col1" placeholder="direccion de correo" >
</div>
<div class="textarea_box">
<span>Su mensaje:</span>
<textarea name="consulta" cols="1" id="consulta" placeholder="Escriba aqui su mensaje"></textarea>
</div>


<a href="javascript:validar();" class="button" onClick="document.getElementById('ContactForm').su bmit()">Enviar</a>
<a href="javascript:validar();" class="button" onClick="document.getElementById('ContactForm').re set()">Borrar</a>
</div>
</form>
crear el archivo enviar.php y colovar lo iguiente

Cita:
<?php
//Correo de destino; donde se enviará el correo.
$correoDestino = "[email protected]";


//Variables.

$Nombre = $_POST['Nombre'];
$mail = $_POST['mail'];
$consulta = $_POST['consulta'];
$telefono = $_POST['telefono'];


//Formateo el asunto del correo
$asunto = "Contacto WEB_$Nombre; $Empresa, ";

//Cuerpo del email que se te enviará.

$cuerpo = "Enviado por: " . $Nombre . "\n, ".
$cuerpo .= "E-mail: " .$mail . "\n";
$cuerpo .= "Comentario:" .$consulta . " \n ";
$cuerpo .= "telefono:" .$telefono . " \n ";
// Envío el mensaje
// Envío el mensaje
mail( $correoDestino, $asunto, $cuerpo );

//$mail_status = mail( $mail_to );
?>
<script language="javascript" type="text/javascript">
alert('SE ENVIO CON EXITO. PRONTO ESTAREMOS EN CONTACTO CON USTED,PRESIONE ACEPTAR');
window.location = 'index.html';
</script>

PD: pero la verdad te recomiendo usar phpmailer o swifmailer, son mas seguros por estos codigos simples son muy rapidos de ser infectados y envian spam.

Saludos