Guest User

Untitled

a guest
Nov 2nd, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. <?php
  2. $connect = mysqli_connect("localhost", "root", "root", "database");
  3. global $connect;
  4.  
  5. $name = $_POST["name"];
  6. global $connect,$name;
  7. $statement = mysqli_prepare($connect, "INSERT INTO table (name) VALUES (?)");
  8. mysqli_stmt_bind_param($statement, "s",$name);
  9. mysqli_stmt_execute($statement);
  10. mysqli_stmt_close($statement);
  11.  
  12. $response = array();
  13. $response["success"] = true;
  14. echo json_encode($response);
  15.  
  16. require_once 'PHPMailer-master/PHPMailerAutoload.php';
  17. $mail = new PHPMailer;
  18. $mail->SMTPDebug = 3;
  19. $mail->isSMTP();
  20. $mail->Host = 'smtp.gmail.com';
  21. $mail->SMTPAuth = true;
  22. $mail->Username = 'test@gmail.com';
  23. $mail->Password = '1234';
  24. $mail->SMTPSecure = 'tls';
  25. $mail->Port = 587;
  26. $mail->setFrom('email@gmail.com', 'Mailer');
  27. $mail->addAddress('email@gmail', 'Receipent');
  28. $mail->isHTML(true);
  29. $mail->Subject = 'Here is the subject';
  30. $mail->Body = 'This is the HTML message body <b>in bold!</b>';
  31. $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  32. if(!$mail->send()) {
  33. echo 'Message could not be sent.';
  34. echo 'Mailer Error: ' . $mail->ErrorInfo;
  35. }
  36. else {
  37. echo 'Message has been sent';
  38. }
  39. ?>
Add Comment
Please, Sign In to add comment