Advertisement
Guest User

Untitled

a guest
Oct 11th, 2017
559
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.71 KB | None | 0 0
  1. Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:xampphtdocspruebaenviar.php on line 17
  2. El mensaje se ha enviado correctamente.
  3.  
  4. <!DOCTYPE html>
  5. <html lang="en">
  6. <head>
  7. <meta charset="UTF-8">
  8. <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  9. <title>Slider Jquery</title>
  10. <link rel="stylesheet" href="css/estilos.css">
  11. <link rel="stylesheet" href="css/font-awesome.css">
  12.  
  13. <script src="js/jquery-3.1.0.min.js"></script>
  14. <script src="js/main.js"></script>
  15. </head>
  16. <body>
  17. <div class="slideshow">
  18. <ul class="slider">
  19. <li>
  20. <a href="primera.html">
  21. <img src="img/1.jpg" alt="">
  22. <section class="caption">
  23. <h1>Primera imagen</h1>
  24. <p>Primera imagen. Slider personalizado.</p>
  25. </section>
  26. </a>
  27. </li>
  28. <li>
  29. <a href="segunda.html">
  30. <img src="img/2.jpg" alt="">
  31. <section class="caption">
  32. <h1>Segunda imagen</h1>
  33. <p>Segunda imagen. Slider personalizado.</p>
  34. </section>
  35. </a>
  36. </li>
  37. <li>
  38. <a href="tercera.html">
  39. <img src="img/3.jpg" alt="">
  40. <section class="caption">
  41. <h1>Tercera imagen.</h1>
  42. <p>Tercera imagen. Slider personalizado.</p>
  43. </section>
  44. </a>
  45. </li>
  46. <li>
  47. <a href="cuarta.html">
  48. <img src="img/4.jpg" alt="">
  49. <section class="caption">
  50. <h1>Cuarta imagen</h1>
  51. <p>Cuarta imagen. Slider personalizado.</p>
  52. </section>
  53. </a>
  54. </li>
  55. </ul>
  56.  
  57. <ol class="pagination">
  58. </ol>
  59.  
  60. <div class="left">
  61. <span class="fa fa-chevron-left"></span>
  62. </div>
  63.  
  64. <div class="right">
  65. <span class="fa fa-chevron-right"></span>
  66. </div>
  67. </div>
  68. <br/><br/><br/><br/>
  69.  
  70. <div class="formulario">
  71. <center>
  72. <h1>Formulario de contacto</h1><br/>
  73.  
  74. <form action="enviar.php" method="post">
  75. Nombre: <input type="text" name="nombre" placeholder="Introduzca un nombre..." required /> &nbsp; &nbsp; &nbsp; &nbsp;
  76. Email: <input type="email" name="email" placeholder="Introduzca un email..." required /><br/><br/>&nbsp; &nbsp; &nbsp; &nbsp;
  77. Asunto: <input type="text" name="asunto" placeholder="Introduzca un asunto..." required /><br/><br/>
  78. <textarea type="text" name="mensaje" placeholder="Introduzca un mensaje..." required cols="40" rows="3"></textarea><br/>
  79. <input type="submit" name="enviar" value="Enviar mensaje"/>
  80. </form></center>
  81. </div>
  82. <br/><br/><br/>
  83. </body>
  84. </html>
  85.  
  86. <?php
  87. $myemail = "omaza1900@hotmail.com";
  88. $nombre = $_POST["nombre"];
  89. $email = $_POST["email"];
  90. $asunto = $_POST["asunto"];
  91. $mensaje = $_POST["mensaje"];
  92.  
  93. $to = $myemail;
  94. $email_subject = "Asunto: $asunto";
  95. $email_body = "Has recibido un mensaje.
  96. n Nombre: $nombre
  97. n Correo: $email
  98. n Mensaje: $mensaje
  99. nn Muchas gracias por su atención.";
  100. $headers = "From: $email";
  101.  
  102. mail($to, $email_subject, $email_body, $headers);
  103. echo "El mensaje se ha enviado correctamente.";
  104. sleep(3);
  105. header("Location: index.html");
  106. ?>
  107.  
  108. require_once('../class.phpmailer.php');
  109. $mail = new PHPMailer();
  110. //indico a la clase que use SMTP
  111. $mail­>IsSMTP();
  112. //permite modo debug para ver mensajes de las cosas que van ocurriendo
  113. $mail­>SMTPDebug = 2;
  114. //Debo de hacer autenticación SMTP
  115. $mail­>SMTPAuth = true;
  116. $mail­>SMTPSecure = "ssl";
  117. //indico el servidor de Gmail para SMTP
  118. $mail­>Host = "smtp.gmail.com";
  119. //indico el puerto que usa Gmail
  120. $mail­>Port = 465;
  121. //indico un usuario / clave de un usuario de gmail
  122. $mail­>Username = "tu_correo_electronico_gmail@gmail.com";
  123. $mail­>Password = "tu clave";
  124. $mail­>SetFrom('tu_correo_electronico_gmail@gmail.com', 'Nombre completo');
  125. $mail­>AddReplyTo("tu_correo_electronico_gmail@gmail.com","Nombre completo");
  126. $mail­>Subject = "Envío de email usando SMTP de Gmail";
  127. $mail­>MsgHTML("Hola que tal, esto es el cuerpo del mensaje!");
  128. //indico destinatario
  129. $address = "destinatario@delcorreoe.com";
  130. $mail­>AddAddress($address, "Nombre completo");
  131. if(!$mail­>Send()) {
  132. echo "Error al enviar: " . $mail­>ErrorInfo;
  133. } else {
  134. echo "Mensaje enviado!";
  135. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement