Ver Mensaje Individual
  #20 (permalink)  
Antiguo 26/03/2013, 10:04
alex1084
 
Fecha de Ingreso: abril-2008
Ubicación: El Salvador
Mensajes: 736
Antigüedad: 16 años
Puntos: 47
Respuesta: Error con mail()

Mira prueba con este..

Código PHP:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5.     <title>Contacto - Representaciones Jes&uacute;s Suviri</title>
  6.     <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
  7.     <meta name="author" content="Abel Suviri">
  8.     <meta name="keywords" content="baño, ducha, grifo, mampara, representaciones, suviri">
  9.     <link rel="stylesheet" type="text/css" href="style.css">
  10.     <script type="text/javascript">
  11.         function validacion(){
  12.             var nombre = document.getElementById("nombre").value;
  13.             var email = document.getElementById("email").value;
  14.             var asunto = document.getElementById("asunto").value;
  15.             var mensaje = document.getElementById("mensaje").value;
  16.             var formato = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
  17.             if(nombre == ""){
  18.                 alert('Introduzca un nombre')
  19.                 return false;
  20.             }
  21.             var v_email = formato.test(email);
  22.             if((v_email != true)||(email == "")){
  23.                 alert('Introduzca un email v\u00e1lido');
  24.                 return false;
  25.             }
  26.             if(asunto == ""){
  27.                 alert('Introduzca un asunto')
  28.                 return false;
  29.             }
  30.             if(mensaje == ""){
  31.                 alert('Introduzca un mensaje')
  32.                 return false;
  33.             }
  34.             return true;
  35.             alert('El mensaje se ha enviado correctamente');
  36.         }
  37.     </script>
  38. </head>
  39. <body>
  40. <?php
  41. if(isset($_POST["enviar"])){
  42.     $Nombre = $_POST['nombre'];
  43.     $Email = $_POST['email'];
  44.     $Asunto = $_POST['asunto'];
  45.     $Mensaje = $_POST['mensaje'];
  46.     $header = 'De: ' . $Email . " \r\n";
  47.     $header .= "X-Mailer: PHP/" . phpversion() . " \r\n";
  48.     $header .= "Mime-Version: 1.0 \r\n";
  49.     $header .= "Content-Type: text-plain";
  50.     $mensaje = "Nombre: " . $Nombre . " \r\n";
  51.     $mensaje = "Email: " . $Email . " \r\n";
  52.     $mensaje = "Asunto: " . $Asunto . " \r\n";
  53.     $mensaje = "Mensaje: " . $Mensaje . " \r\n";
  54.     $mensaje = "Enviado el " . date("d/m/y \a \l\a\s H:i:s ");
  55.     $para = '[email protected]';
  56.     mail($para, utf8_decode($mensaje), $header);
  57.     echo "Su mensaje se ha enviado correctamente";
  58. }
  59. ?>  
  60.     <div id="banner">
  61.         <img src="images/banner.gif"></img>
  62.     </div>
  63.     <div id="menu">
  64.         <ul>
  65.             <li><a href="index.html">inicio</a>
  66.             <li><a href="firmas.html">firmas</a>
  67.             <li><a href="productos.html">productos</a>
  68.             <li><a href="descargas.html">descargas</a>
  69.             <li><a href="contacto.php">contacto</a>
  70.         </ul>
  71.     </div> 
  72.     <div id="contacto">
  73.         <h1>Jes&uacute;s Suviri</h1>
  74.         Telf. 610 725 255<br>
  75.         Fax. 952 411 242<br>
  76.         Mail: [email protected]<br>
  77.         M&Aacute;LAGA
  78.     </div> 
  79.     <hr>
  80.     <div id="formulario">
  81.         <p>Puede contactar tambi&eacute;n rellenando el siguiente formulario con los datos solicitados.</p>
  82.         <form name="formulario" action="contacto.php" method="post" onsubmit="return validacion()">
  83.             <label for="nombre">Nombre: </label><input type="text" size="50" value="" id="nombre" name="nombre" /><br />
  84.             <label for="email">Email: </label><input type="text" size="50" value="" id="email" name="email" /><br />
  85.             <label for="asunto">Asunto: </label><input type="text" size="50" id="asunto" name="asunto" /><br />
  86.             <label for="mensaje">Mensaje:</label><textarea cols="37" rows="10" id="mensaje" name="asunto"></textarea><br />
  87.             <input type="submit" value="Enviar" class="boton" name="enviar" />
  88.             <input type="reset" value="Limpiar" class="boton" />
  89.         </form>
  90.     </div> 
  91.     <div id="copyright">
  92.     Dise&ntilde;ado por Abel Suviri ([email protected])
  93.     </div>
  94. </body>
  95. </html>