Advertisement
Guest User

Código

a guest
Apr 17th, 2017
558
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. <?php
  2. $corpo = "Nome:". $_POST['nome']."\n";
  3. $corpo = $corpo . "Email:". $_POST['email']."\n";
  4. $corpo = $corpo . "Telefone:". $_POST['telefone']."\n";
  5. $corpo = $corpo . "Serviço:". $_POST['servico']."\n";
  6.  
  7.  
  8. require 'PHPMailer/PHPMailerAutoload.php';
  9.  
  10. $mail = new PHPMailer;
  11. $mail->Charset = 'UTF-8';
  12.  
  13. //$mail->SMTPDebug = 3;
  14. $mail->isSMTP();
  15. $mail->Host = 'test.com.br';
  16. $mail->SMTPAuth = true;
  17. $mail->Username = 'contato@teste.com';
  18. $mail->Password = '*********';
  19. $mail->SMTPSecure = 'ssl';
  20. $mail->Port = 852;
  21.  
  22. $mail->setFrom('contato@test.com', 'tttt');
  23. $mail->addAddress('test@gmail.com', 'eeee');
  24. $mail->isHTML(true);
  25.  
  26. $mail->Subject = 'Orcamento';
  27. $mail->Body = $corpo;
  28. $mail->AltBody = $corpo;
  29.  
  30.  
  31. if (isset($_POST['g-recaptcha-response'])) {
  32. $captcha_data = $_POST['g-recaptcha-response'];
  33. }
  34. // Se nenhum valor foi recebido, o usuário não realizou o captcha
  35. if (!$captcha_data) {
  36. echo "<script type=\"text/javascript\">alert(\"Ops! Falha no envio do formulario.\");
  37. history.go(-1);</script>n";
  38. exit;
  39. }
  40.  
  41. $resposta = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=OMfVwUdvE&response=".$captcha_data."&remoteip=".$_SERVER['REMOTE_ADDR']);
  42. if ($resposta.success) {
  43. echo "<script type=\"text/javascript\">alert(\"Seu formulario foi enviado com sucesso! Em breve entraremos em contato.\");
  44. history.go(-1);</script>n";
  45. }
  46. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement