Advertisement
Guest User

Untitled

a guest
May 31st, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. require 'PHPMailer/PHPMailerAutoload.php';
  2. $nome = $_POST["nome"];
  3. $subject = $_POST["subject"];
  4. $message = $_POST["message"];
  5. $email = $_POST["email"];
  6. $contacto = $_POST["contacto"];
  7. $body = "<p>Mail recebido de: </p>" . $nome . "<p>Email:</p>" . $email . "<p> Contacto:</p>" . $contacto . "<p>Mensagem:</p>" . $message ;
  8. $mail = new PHPMailer();
  9. $mail->CharSet = "text/html; charset=UTF-8;";
  10. $mail->SMTPDebug = 0; // debugging: 1 = errors and messages, 2 = messages only
  11. $mail->CharSet = 'UTF-8';
  12. $mail->SMTPAuth = true;
  13. $mail->SMTPSecure = 'ssl';
  14. $mail->Host = "smtp.gmail.com";
  15. $mail->Port = 587;
  16. $mail->Username = "the email;
  17. $mail->Password = the password;
  18. $mail->SetFrom('the email', 'Organizer');
  19. $mail->Subject = "[ORÇAMENTO] " . $subject;
  20. $mail->Body = $body;
  21. $mail->IsHTML(true);
  22. $mail->AddAddress("the email");
  23. if(!$mail->Send()) {
  24. echo "Mailer Error: " . $mail->ErrorInfo;
  25. } else {
  26. $sucesso = 'Mensagem enviada com sucesso!';
  27. }
  28.  
  29. require '../PHPMailer/PHPMailerAutoload.php';
  30. $body = "<p>Car(a) " . ${'user' . $i} . ",</p> <p> Foi lhe associado(a) uma nova ocorrência. Consulte-a em http://www.organizer.com.pt . </p>";
  31. $mail = new PHPMailer();
  32. $mail->CharSet = "text/html; charset=UTF-8;";
  33. $mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
  34. $mail->CharSet = 'UTF-8';
  35. $mail->SMTPAuth = true;
  36. $mail->SMTPSecure = 'ssl';
  37. $mail->Host = "smtp.gmail.com";
  38. $mail->Port = 587;
  39. $mail->Username = "the email";
  40. $mail->Password = the password;
  41. $mail->SetFrom('the email', 'Organizer');
  42. $mail->Subject = "Nova Ocorrência";
  43. $mail->Body = $body;
  44. $mail->IsHTML(true);
  45. $mail->AddAddress($email);
  46. if(!$mail->Send()) {
  47. echo "Mailer Error: " . $mail->ErrorInfo;
  48. } else {
  49. $sucesso = 'Mensagem enviada com sucesso!';
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement