Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/09/2019, 14:16
Avatar de ceaped
ceaped
 
Fecha de Ingreso: febrero-2004
Mensajes: 2.185
Antigüedad: 20 años, 2 meses
Puntos: 9
Pregunta Formulario de contacto no envía emails

Buenas tardes para todos
Tengo el siguiente formulario:

HTML
Código HTML:
Ver original
  1. <form action="send.php" method="post">
  2. <h3>Contáctenos</h3>
  3. <p>Texto...</p>
  4.  
  5. <label for="nombre">Nombre</label>
  6. <input type="text" name="nombre" id="nombre" />
  7.  
  8. <label for="mail">Email</label>
  9. <input type="text" name="mail" id="mail" />
  10.  
  11. <label for="telefono">Teléfono</label>
  12. <input type="text" name="telefono" id="telefono" />
  13.  
  14. <label for="asunto">Asunto</label>
  15. <textarea name="asunto" id="asunto" cols="40" rows="6"></textarea>
  16.  
  17.  
  18. <button type="submit">Enviar...</button>
  19.  
  20. </form>


PHP
Código PHP:
Ver original
  1. <!doctype html>
  2. <html lang="es">
  3.  
  4. <head>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width; initial-scale=1.0">
  7. <title>Titulo...</title>
  8.  
  9. <!--Estilo formulario de registro-->
  10. <link href="css/estilo_formulario.css" rel="stylesheet" type="text/css" />
  11.  
  12. </head>
  13.  
  14. <div id="container">
  15.  
  16. <body>
  17. <div class='banner_inicio'><img src='images/banner_inicio.png' alt='texto...' /></div>
  18. <?php
  19. if(isset($_POST["nombre"]) && isset($_POST["mail"]) && isset($_POST["telefono"]) && isset($_POST["asunto"])){
  20. ///
  21. $fecha = date("D-M-y H:i");
  22. ///
  23. $mymail = "[email protected]";
  24. ///
  25. $mensaje= "Correo enviado desde el sitio Web...";
  26. ///
  27. $contenido .= "Nombre : ".$_POST["nombre"]."\n";
  28. $contenido .= "email : ".$_POST["mail"]."\n";
  29. $contenido .= "Telefono : ".$_POST["telefono"]."\n";
  30. $contenido .= "Asunto : ".$_POST["asunto"]."\n";
  31. $contenido .= "El mensaje fue escrito el ".$fecha;
  32. ///
  33. $header = "From:".$_POST["mail"]."\nReply-To:".$_POST["mail"]."\n";
  34. $header .= "X-Mailer:PHP/".phpversion()."\n";
  35. $header .= "Mime-Version: 1.0\n";
  36. $header .= "Content-Type: text/plain";
  37. ///
  38. mail($mymail, $mensaje, utf8_decode($contenido) ,$header);
  39.  
  40.  
  41. echo "<div class='mensaje'>Su correo ha sido enviado correctamente...</div>";
  42.  
  43. echo "<div class='regresar'><a href='index.html' title='Regresar'><p>Regresar</p></a></div></p>";
  44. }
  45. ?>
  46.  
  47. </div>
  48.  
  49. </body>
  50. </html>

Además cómo agregarle un texto que diga "Correo no enviado..." cuando el correo no sea enviado

Gracias por su ayuda
__________________
Diseñador Gráfico publicitario

Última edición por ceaped; 09/09/2019 a las 14:28 Razón: Cambiar texto