Advertisement
Guest User

Untitled

a guest
Mar 1st, 2019
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. if(!validar_nome($name) || !validar_email($email) || !validar_budget($budget) || !validar_mensagem($description) || !validar_cel($telefone || !validar_endereço($address))){
  2. header('Location: index.php');
  3. die();
  4. }
  5.  
  6. try {
  7.  
  8. $mail = new PHPMailer(true);
  9.  
  10. //Server settings
  11. $mail->setLanguage("en");
  12. $mail->SMTPDebug = 0; #
  13. $mail->isSMTP(); // Set mailer to use SMTP
  14. $mail->Host = 'smtp.gmail.com'; //
  15. $mail->SMTPAuth = true;
  16. $mail->Username = '------';
  17. $mail->Password = '-----';
  18. $mail->SMTPSecure = 'ssl';
  19. $mail->Port = 465;
  20.  
  21. //Recipients
  22. $mail->setFrom('-----', 'Ramdon Name');
  23. $mail->addAddress('------'); // Add a recipient
  24.  
  25. //Content
  26. $mail->isHTML(true); // Set email format to HTML
  27. $mail->Subject = "Contact " . $name;
  28. $mail->Body = "<b>E-mail</b>: " . $email . "." . "<br>" .
  29. "<b>Address: </b>" . $address . "." . "<br>" .
  30. "<b>City: </b>" . $city . "." . "<br>" .
  31. "<b>Telephone: </b>" . $telefone . "." . "<br>" .
  32. "<b>Budget: </b>" . $budget . "." . "<br>" .
  33. "<b>Services: </b>" . $services1 . "," .
  34. $services2 . "," .
  35. $services3 . "," .
  36. $services4 . "," .
  37. $services5 . "," .
  38. $services6 . "," .
  39. $services7 . "<br>" . "<br>" .
  40. "<b>Service description: </b>" . $description . ".";
  41.  
  42. $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  43. $mail->send();
  44.  
  45. }
  46.  
  47. catch (Exception $e) {
  48. echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement