Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
- El mensaje se ha enviado correctamente.
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
- <title>Slider Jquery</title>
- <link rel="stylesheet" href="css/estilos.css">
- <link rel="stylesheet" href="css/font-awesome.css">
- <script src="js/jquery-3.1.0.min.js"></script>
- <script src="js/main.js"></script>
- </head>
- <body>
- <div class="slideshow">
- <ul class="slider">
- <li>
- <a href="primera.html">
- <img src="img/1.jpg" alt="">
- <section class="caption">
- <h1>Primera imagen</h1>
- <p>Primera imagen. Slider personalizado.</p>
- </section>
- </a>
- </li>
- <li>
- <a href="segunda.html">
- <img src="img/2.jpg" alt="">
- <section class="caption">
- <h1>Segunda imagen</h1>
- <p>Segunda imagen. Slider personalizado.</p>
- </section>
- </a>
- </li>
- <li>
- <a href="tercera.html">
- <img src="img/3.jpg" alt="">
- <section class="caption">
- <h1>Tercera imagen.</h1>
- <p>Tercera imagen. Slider personalizado.</p>
- </section>
- </a>
- </li>
- <li>
- <a href="cuarta.html">
- <img src="img/4.jpg" alt="">
- <section class="caption">
- <h1>Cuarta imagen</h1>
- <p>Cuarta imagen. Slider personalizado.</p>
- </section>
- </a>
- </li>
- </ul>
- <ol class="pagination">
- </ol>
- <div class="left">
- <span class="fa fa-chevron-left"></span>
- </div>
- <div class="right">
- <span class="fa fa-chevron-right"></span>
- </div>
- </div>
- <br/><br/><br/><br/>
- <div class="formulario">
- <center>
- <h1>Formulario de contacto</h1><br/>
- <form action="enviar.php" method="post">
- Nombre: <input type="text" name="nombre" placeholder="Introduzca un nombre..." required />
- Email: <input type="email" name="email" placeholder="Introduzca un email..." required /><br/><br/>
- Asunto: <input type="text" name="asunto" placeholder="Introduzca un asunto..." required /><br/><br/>
- <textarea type="text" name="mensaje" placeholder="Introduzca un mensaje..." required cols="40" rows="3"></textarea><br/>
- <input type="submit" name="enviar" value="Enviar mensaje"/>
- </form></center>
- </div>
- <br/><br/><br/>
- </body>
- </html>
- <?php
- $myemail = "omaza1900@hotmail.com";
- $nombre = $_POST["nombre"];
- $email = $_POST["email"];
- $asunto = $_POST["asunto"];
- $mensaje = $_POST["mensaje"];
- $to = $myemail;
- $email_subject = "Asunto: $asunto";
- $email_body = "Has recibido un mensaje.
- n Nombre: $nombre
- n Correo: $email
- n Mensaje: $mensaje
- nn Muchas gracias por su atención.";
- $headers = "From: $email";
- mail($to, $email_subject, $email_body, $headers);
- echo "El mensaje se ha enviado correctamente.";
- sleep(3);
- header("Location: index.html");
- ?>
- require_once('../class.phpmailer.php');
- $mail = new PHPMailer();
- //indico a la clase que use SMTP
- $mail>IsSMTP();
- //permite modo debug para ver mensajes de las cosas que van ocurriendo
- $mail>SMTPDebug = 2;
- //Debo de hacer autenticación SMTP
- $mail>SMTPAuth = true;
- $mail>SMTPSecure = "ssl";
- //indico el servidor de Gmail para SMTP
- $mail>Host = "smtp.gmail.com";
- //indico el puerto que usa Gmail
- $mail>Port = 465;
- //indico un usuario / clave de un usuario de gmail
- $mail>Username = "tu_correo_electronico_gmail@gmail.com";
- $mail>Password = "tu clave";
- $mail>SetFrom('tu_correo_electronico_gmail@gmail.com', 'Nombre completo');
- $mail>AddReplyTo("tu_correo_electronico_gmail@gmail.com","Nombre completo");
- $mail>Subject = "Envío de email usando SMTP de Gmail";
- $mail>MsgHTML("Hola que tal, esto es el cuerpo del mensaje!");
- //indico destinatario
- $address = "destinatario@delcorreoe.com";
- $mail>AddAddress($address, "Nombre completo");
- if(!$mail>Send()) {
- echo "Error al enviar: " . $mail>ErrorInfo;
- } else {
- echo "Mensaje enviado!";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement