Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('recaptchalib.php');
- require('funciones.php');
- $conexion = conectarBD();
- $privkey = "6LdvPiITAAAAAOkQ6LpzWmpQW3kcNtmMQO64Vqm9";
- $verify = recaptcha_check_answer($privkey, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
- require 'phpmailer/PHPMailerAutoload.php';
- $mail = new PHPMailer;
- $mail->isSMTP();
- $mail->Host = 'smtp.live.com';
- $mail->SMTPAuth = true;
- $mail->Username = 'prowebutn@hotmail.com';
- $mail->Password = 'asereje124';
- $mail->SMTPSecure = 'tls';
- $mail->Port = 587;
- $mail->setFrom($_POST['email']);
- $mail->addAddress('prowebutn@hotmail.com');
- $mail->isHTML(false);
- $mail->Subject = $_POST['asunto'];
- $mail->Body = "De: " .$_POST['nombre'] ."\n" ."\n" .$_POST['mensaje'];
- if ($verify->is_valid) {
- header("refresh:3;url=contacto.php");
- $nombre = $_POST['nombre'];
- $email = $_POST['email'];
- $msj = $_POST['mensaje'];
- $sql_insert = "insert into mensajes (email, msj, nombre) values ('$email', '$msj', '$nombre')";
- mysqli_query($conexion, $sql_insert);
- if(!$mail->send()) {
- echo 'Message could not be sent.';
- echo 'Mailer Error: ' . $mail->ErrorInfo;
- } else {
- echo 'Message sent';
- }
- die();
- }else {
- header("refresh:3;url=contacto.php");
- echo "Oops parece que el codigo de verificacion no es correcto. Volviendo a la página anterior.";
- }
- die();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement