Guest User

Untitled

a guest
Oct 23rd, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.44 KB | None | 0 0
  1. <?php
  2.  
  3. $nome = utf8_decode (strip_tags(trim($_POST['nomeremetente'])));
  4. $email = utf8_decode (strip_tags(trim($_POST['emailremetente'])));
  5. $tel = utf8_decode (strip_tags(trim($_POST['tel'])));
  6. $cpf = utf8_decode (strip_tags(trim($_POST['cpf'])));
  7. $num = utf8_decode (strip_tags(trim($_POST['num'])));
  8. $cep = utf8_decode (strip_tags(trim($_POST['cep'])));
  9.  
  10. require_once('PHPMailer/class.phpmailer.php');
  11.  
  12. $path = $_POST['path'];
  13. $filename = $_POST['filename'];
  14. $newpath = "fotos/".$path;
  15.  
  16. $Email = new PHPMailer();
  17. $Email->SetLanguage("br");
  18. $Email->IsSMTP(); // Habilita o SMTP
  19. $Email->SMTPAuth = true; //Ativa e-mail autenticado
  20. $Email->Host = '**********************'; // Servidor de envio # verificar qual o host correto com a hospedagem as vezes fica como smtp.
  21. $Email->Port = '***'; // Porta de envio
  22. $Email->Username = '**********************'; //e-mail que será autenticado
  23. $Email->Password = '**********************'; // senha do email
  24. // ativa o envio de e-mails em HTML, se false, desativa.
  25. $Email->IsHTML(true);
  26. // email do remetente da mensagem
  27. $Email->From = '**********************';
  28. // nome do remetente do email
  29. $Email->FromName = utf8_decode($email);
  30. // Endereço de destino do emaail, ou seja, pra onde você quer que a mensagem do formulário vá?
  31. $Email->AddReplyTo($email, $nome);
  32. $Email->AddAddress("**********************"); // para quem será enviada a mensagem
  33. $Email->AddAddress("**********************");
  34. $Email->AddAddress("**********************");
  35. // informando no email, o assunto da mensagem
  36. $Email->Subject = "Contrato "****** *******" - $nome";
  37. $Email->AddAttachment($newpath);
  38. // Define o texto da mensagem (aceita HTML)
  39.  
  40. $Email->Body = "
  41. <html>
  42. <head>
  43. <title>Pré Contrato</title>
  44. </head>
  45. <body>
  46. <table>
  47. <p>Virtu@lnet Telecom Contrato</p>
  48. Nome:<strong> $nome</strong><br>
  49. E-mail:<strong> $email</strong><br>
  50. Celular/Telefone:<strong> $tel</strong><br>
  51. CPF:<strong> $cpf</strong><br>
  52. RG:<strong> $num</strong><br>
  53. CEP:<strong> $cep</strong><br>
  54. </table>
  55. </body>
  56. </html>";
  57. // verifica se está tudo ok com oa parametros acima, se nao, avisa do erro. Se sim, envia.
  58. if(!$Email->Send()){
  59. echo "<p>A mensagem não foi enviada. </p>";
  60. echo "Erro: " . $Email->ErrorInfo;
  61. }else{
  62. echo "
  63. <html>
  64. <div class='alert alert-success' role='alert'>
  65. <h4 class='alert-heading'>Well Done!</h4>
  66. <p>Email enviado para central da Virtu@lnet Telecom será respondido em 2 dias uteis vamos analisar os documentos e vamos entrar em contato.</p>
  67. <hr>
  68. <p class='mb-0'>Atendemos somente em sapucaia do sul</p>
  69. </div>
  70. </html>";
  71.  
  72. echo "<html> <div class='alert alert-warning alert-dismissible fade show' role='alert'>
  73. <strong>Aviso:</strong> Contrato so vai ser valido se todas informações tiverem corretas.
  74. <button type='button' class='close' data-dismiss='alert' aria-label='Close'>
  75. <span aria-hidden='true'>&times;</span>
  76. </button>
  77. </div> </html>";
  78.  
  79. }
Add Comment
Please, Sign In to add comment