Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $connect = mysqli_connect("localhost", "root", "root", "database");
- global $connect;
- $name = $_POST["name"];
- global $connect,$name;
- $statement = mysqli_prepare($connect, "INSERT INTO table (name) VALUES (?)");
- mysqli_stmt_bind_param($statement, "s",$name);
- mysqli_stmt_execute($statement);
- mysqli_stmt_close($statement);
- $response = array();
- $response["success"] = true;
- echo json_encode($response);
- require_once 'PHPMailer-master/PHPMailerAutoload.php';
- $mail = new PHPMailer;
- $mail->SMTPDebug = 3;
- $mail->isSMTP();
- $mail->Host = 'smtp.gmail.com';
- $mail->SMTPAuth = true;
- $mail->Username = 'test@gmail.com';
- $mail->Password = '1234';
- $mail->SMTPSecure = 'tls';
- $mail->Port = 587;
- $mail->setFrom('email@gmail.com', 'Mailer');
- $mail->addAddress('email@gmail', 'Receipent');
- $mail->isHTML(true);
- $mail->Subject = 'Here is the subject';
- $mail->Body = 'This is the HTML message body <b>in bold!</b>';
- $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
- if(!$mail->send()) {
- echo 'Message could not be sent.';
- echo 'Mailer Error: ' . $mail->ErrorInfo;
- }
- else {
- echo 'Message has been sent';
- }
- ?>
Add Comment
Please, Sign In to add comment