Guest User

Untitled

a guest
Mar 18th, 2018
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. <form role="form" method="post" action="send_email.php" id="formContato">
  2. <div class="left">
  3. <fieldset class="mail"><input placeholder="Endereço e-mail" type="text" name="email" id="email"></fieldset>
  4. <fieldset class="name"><input placeholder="Primeiro nome" type="text" name="primeiro_nome" id="primeiro_nome"></fieldset>
  5. <fieldset class="name"><input placeholder="Segundo nome" type="text" name="ultimo_nome" id="ultimo_nome"></fieldset>
  6. <fieldset class="name"><input placeholder="Telefone" type="text" name="telefone" id="telefone"></fieldset>
  7. <fieldset class="subject">
  8. <select name="assunto" id="assunto">
  9. aias, <option>Dúvida</option>
  10. <option>Reclamações</option>
  11. <option>Outros</option>
  12. </select>
  13. </fieldset>
  14. </div>
  15. <div class="right">
  16. <fieldset class="question">
  17. <textarea name="mensagem" id="mensagem" placeholder="Digite sua mensagem..."></textarea></fieldset>
  18. </div>
  19. <div class="btn-holder">
  20. <button class="btn blue" type="submit" value="enviar" name="enviar" id="enviar">Enviar</button>
  21. </div>
  22. </form>
  23.  
  24. <?php
  25.  
  26. require 'PHPMailerAutoload.php';
  27. require 'vendor/autoload.php';
  28. require 'PHPMailer';
  29.  
  30. if(isset($_POST['enviar'])){
  31.  
  32. // Fetching data that is entered by the user
  33. $email = $_POST['email'];
  34. $primeiro_nome = $_POST['primeiro_nome'];
  35. $ultimo_nome = $_POST['ultimo_nome'];
  36. $mensagem = $_POST['mensagem'];
  37. $assunto = $_POST['assunto'];
  38. $telefone = $_PPOST['telefone'];
  39. $to_id = 'emailunionjunior1@gmail.com';
  40.  
  41. // Configuring SMTP server settings
  42. $mail = new PHPMailer;
  43. $mail->isSMTP();
  44. $mail->Host = 'smtp.gmail.com';
  45. $mail->Port = 587;
  46. $mail->SMTPSecure = 'tls';
  47. $mail->SMTPAuth = true;
  48. $mail->Username = $to_id;
  49. $mail->Password = 'senha';
  50.  
  51. // Email Sending Details
  52. $mail->addAddress($to_id);
  53. $mail->Subject = $assunto;
  54. $mail->msgHTML($email . "rn" .$mensagem);
  55.  
  56. // Success or Failure
  57. if (!$mail->send()) {
  58. $error = "Mailer Error: " . $mail->ErrorInfo;
  59. echo '<p id="para">'.$error.'</p>';
  60. }
  61. else {
  62. echo '<p id="para">Message sent!</p>';
  63. }
  64. }
  65. else{
  66. echo '<p id="para">Please enter valid data</p>';
  67. }
  68. ?>
Add Comment
Please, Sign In to add comment