Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.93 KB | None | 0 0
  1. <?php
  2. require_once('PHPMailer/class.phpmailer.php');
  3.  
  4. $form = $_POST['form'];
  5. $nome = $_POST['nome'];
  6. $bandeira = $_POST['bandeira'];
  7. $estado = $_POST['estado'];
  8. $cidade = $_POST['cidade'];
  9. $email = $_POST['email'];
  10. $tel = $_POST['tel'];
  11. $veiculo = $_POST['veiculo'];
  12. $placa = $_POST['placa'];
  13. $servico = $_POST['servico'];
  14. $data = $_POST['data'];
  15. $assunto = $_POST['assunto'];
  16. $mensagem = $_POST['mensagem'];
  17. $copia = $_POST['enviar_copia'];
  18. $possui_veiculo = $_POST['possui_veiculo'];
  19.  
  20. if($copia != "Sim"){
  21. $copia = "Não";
  22. };
  23.  
  24. $mail = new PHPMailer(true); //New instance, with exceptions enabled
  25.  
  26. if($form == "Agendamento de Serviço"){
  27. $body = "<strong>Nome:</strong> " . $nome . "<br>";
  28. $body .= "<strong>Bandeira:</strong> " . $bandeira . "<br>";
  29. $body .= "<strong>Cidade:</strong> " . $cidade . "<br>";
  30. $body .= "<strong>E-mail:</strong> " . $email . "<br>";
  31. $body .= "<strong>Tel.:</strong> " . $tel . "<br>";
  32. $body .= "<strong>Veículo/Modelo:</strong> " . $veiculo . "<br>";
  33. $body .= "<strong>Placa:</strong> " . $placa . "<br>";
  34. $body .= "<strong>Serviço.:</strong> " . $servico . "<br>";
  35. $body .= "<strong>Data:</strong> " . $data . "<br>";
  36. $body .= "<strong>Uma cópia deste email foi enviada ao remetente?</strong> " . $copia . "<br>";
  37. }
  38.  
  39. if($form == "Agendamento de Test Drive"){
  40. $body = "<strong>Nome:</strong> " . $nome . "<br>";
  41. $body .= "<strong>Bandeira:</strong> " . $bandeira . "<br>";
  42. $body .= "<strong>Cidade:</strong> " . $cidade . "<br>";
  43. $body .= "<strong>E-mail:</strong> " . $email . "<br>";
  44. $body .= "<strong>Tel.:</strong> " . $tel . "<br>";
  45. $body .= "<strong>Veículo:</strong> " . $veiculo . "<br>";
  46. $body .= "<strong>Data:</strong> " . $data . "<br>";
  47. $body .= "<strong>Uma cópia deste email foi enviada ao remetente?</strong> " . $copia . "<br>";
  48. }
  49.  
  50. if($form == "Proposta de compra de veículo"){
  51. $body = "<strong>Nome:</strong> " . $nome . "<br>";
  52. $body .= "<strong>Cidade:</strong> " . $cidade . "<br>";
  53. $body .= "<strong>E-mail:</strong> " . $email . "<br>";
  54. $body .= "<strong>Tel.:</strong> " . $tel . "<br>";
  55. $body .= "<strong>Veículo:</strong> " . $veiculo . "<br>";
  56. $body .= "<strong>Mensagem:</strong> " . $mensagem . "<br>";
  57. }
  58.  
  59. if($form == "Fale Conosco"){
  60. $body = "<strong>Nome:</strong> " . $nome . "<br>";
  61. $body .= "<strong>Bandeira:</strong> " . $bandeira . "<br>";
  62. $body .= "<strong>Cidade:</strong> " . $cidade . "<br>";
  63. $body .= "<strong>E-mail:</strong> " . $email . "<br>";
  64. $body .= "<strong>Assunto:</strong> " . $assunto . "<br>";
  65. $body .= "<strong>Mensagem:</strong> " . $mensagem . "<br>";
  66. }
  67.  
  68. if($form == "newsletter"){
  69. $body = "<strong>Bandeira:</strong> " . $bandeira . "<br>";
  70. $body .= "<strong>Cidade:</strong> " . $cidade . "<br>";
  71. $body .= "<strong>Nome:</strong> " . $nome . "<br>";
  72. $body .= "<strong>E-mail:</strong> " . $email . "<br>";
  73. }
  74.  
  75. if($form == "Landing Page"){
  76. $body = "<strong>Nome:</strong> " . $nome . "<br>";
  77. $body .= "<strong>E-mail:</strong> " . $email . "<br>";
  78. $body .= "<strong>Tel.:</strong> " . $tel . "<br>";
  79. $body .= "<strong>Bandeira:</strong> " . $bandeira . "<br>";
  80. $body .= "<strong>Veículo:</strong> " . $veiculo . "<br>";
  81. $body .= "<strong>Estado:</strong> " . $estado . "<br>";
  82. $body .= "<strong>Cidade:</strong> " . $cidade . "<br>";
  83. $body .= "<strong>Possiu veículo?</strong> " . $possui_veiculo . "<br>";
  84. }
  85.  
  86. $mail->CharSet = "UTF-8";
  87. $mail->SMTPDebug = 0;
  88.  
  89. $mail->AddReplyTo($email, $client);
  90. $mail->From = $email;
  91. $mail->FromName = $nome;
  92.  
  93. if($copia == "Sim"){$mail->AddAddress($email);};
  94. $mail->AddAddress('business@connectlead.com.br');
  95.  
  96. if(isset($assunto)){
  97. $mail->Subject = $assunto;
  98. }else{
  99. $mail->Subject = $form;
  100. }
  101.  
  102. $mail->AltBody = "Para ver essa mensagem utilize um cliente com suporte HTML!";
  103. $mail->WordWrap = 80;
  104.  
  105. $mail->MsgHTML($body);
  106. $mail->IsHTML(true);
  107.  
  108. try {
  109. $mail->Send();
  110. echo "sucesso";
  111. } catch (phpmailerException $e) {
  112. echo $e->errorMessage();
  113. }
  114. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement