Advertisement
Guest User

Untitled

a guest
May 19th, 2019
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. <?php
  2.  
  3. date_default_timezone_set('Etc/UTF-8');
  4.  
  5.  
  6. // Edit this path if PHPMailer is in a different location.
  7. require '../PHPMailer/PHPMailerAutoload.php';
  8. $Mailer->Charset='UTF-8';
  9. $mail = new PHPMailer;
  10. $mail->isSMTP();
  11. $mail->Charset='UTF-8';
  12. /*
  13. * Server Configuration
  14. */
  15.  
  16. $mail->Host = 'smtp.gmail.com'; // Which SMTP server to use.
  17. $mail->Port = 587; // Which port to use, 587 is the default port for TLS security.
  18. $mail->SMTPSecure = 'tls'; // Which security method to use. TLS is most secure.
  19. $mail->SMTPAuth = true; // Whether you need to login. This is almost always required.
  20. $mail->Username = "###########"; // Your Gmail address.
  21. $mail->Password = "##########"; // Your Gmail login password or App Specific Password.
  22.  
  23. /*
  24. * Message Configuration
  25. */
  26. $nome=addslashes($_POST['nome']);
  27. $time=addslashes($_POST['time']);
  28. $turma=addslashes($_POST['turma']);
  29.  
  30. $mail->setFrom('$##############', 'Formulário de Contato'); // Set the sender of the message.
  31. $mail->addAddress('############', 'Suporte Josué'); // Set the recipient of the message.
  32. $mail->Subject = 'Formulário de Contato'; // The subject of the message.
  33.  
  34. /*
  35. * Message Content - Choose simple text or HTML email
  36. */
  37.  
  38. // Choose to send either a simple text email...
  39. $mail->Body = "Nome: ".$nome."\n Time: ".$time."\n Turma: ".$turma; // Set a plain text body.
  40.  
  41. // ... or send an email with HTML.
  42. //$mail->msgHTML(file_get_contents('contents.html'));
  43. // Optional when using HTML: Set an alternative plain text message for email clients who prefer that.
  44. //$mail->AltBody = 'This is a plain-text message body';
  45.  
  46. if( trim($nome) != "" || trim($time) != "" || trim($turma) != ""){
  47. if ($mail->send()) {
  48. echo '<script language="javascript">';
  49. echo 'alert("Email enviado com sucesso!");';
  50. echo "location.href='/EpicWeek/index.html';";
  51. echo '</script>';
  52.  
  53.  
  54. } else {
  55. echo "Mailer Error: " . $mail->ErrorInfo;
  56. }
  57. }else{
  58. echo '<script language="javascript">';
  59. echo 'alert("Não foi possivel enviar o e-mail! Há campos vazios!");';
  60. echo "location.href='/EpicWeek/index.html';";
  61. echo '</script>';
  62. }
  63.  
  64. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement