-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathform.php
More file actions
47 lines (36 loc) · 1.2 KB
/
form.php
File metadata and controls
47 lines (36 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
use PHPMailer\PHPMailer\PHPMailer;
require_once 'phpmailer/Exception.php';
require_once 'phpmailer/PHPMailer.php';
require_once 'phpmailer/SMTP.php';
$mail = new PHPMailer(true);
$alert = '';
if(isset($_POST['submit'])){
$name = $_POST['name'];
$email = $_POST['email'];
$title = $_POST['title'];
$author = $_POST['author'];
try{
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'quadratwemimo@gmail.com';
$mail->Password = 'Sunkanmi01';
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->pORT = '587';
$mail->setfrom('quadratwemimo@gmail.com');
$mail->addAddress('quadratwemimo@gmail.com');
$mail->isHTML(true);
$mail->Subject = 'Message Received (Book Request)';
$mail->Body = "<h3>Name: $name <br>Email: $email <br>Title: $title <br>Author: $author</h3>";
$mail->send();
$alert = '<div class="alert-success">
<span>Request Sent!</span>
</div>';
} catch (Exception $e){
$alert = '<div class="alert-error">
<span>'.$e->getMessage().'</span>
</div>';
}
}
?>