-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
83 lines (78 loc) · 3.17 KB
/
index.php
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
$result="";
if(isset($_POST['submit'])){
require 'phpmailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail-> Host='smtp.gmail.com';
// $mail->Port=5000;
$mail->SMTPAuth=true;
$mail->SMTPSecure='tls';
//edit here
$mail->Username='Your_EMAILID';
$mail->Password='Your_EMAILID_PASSWORD ';
//Edikt-here
$mail->setFrom($_POST['email'],$_POST['name']);
$mail->addAddress('dhillonomhit02@gmail.com');
$mail->addReplyTo($_POST['email'],$_POST['name']);
$mail->isHTML(true);
$mail->Subject='Form Submission: '.$_POST['subject'];
$mail->body='<h1 align=center>Name :' .$_POST['name'].'<br>Email: '.$_POST['email'].'<br>Message: '.$_POST['msg'].'</h1>';
if(!$mail->send()){
$result="Something went wrong.";
}
else{
$result="Thanks ".$_POST['name']."for contacting us.";
}
}
?>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="author" content="Sahil Kumar">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Contact Form Bootstrap</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css">
</head>
<body class="bg-dark">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-4 mt-5 bg-light rounded">
<h1 class="text-center font-weight-bold text-primary">Contact Us</h1>
<hr class="bg-light">
<h5 class="text-center text-success"><?= $result; ?></h5>
<form action="" method="post" id="form-box" class="p-2">
<div class="form-group input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-user"></i></span>
</div>
<input type="text" name="name" class="form-control" placeholder="Enter your name" required>
</div>
<div class="form-group input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-envelope"></i></span>
</div>
<input type="email" name="email" class="form-control" placeholder="Enter your email" required>
</div>
<div class="form-group input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-at"></i></span>
</div>
<input type="text" name="subject" class="form-control" placeholder="Enter subject" required>
</div>
<div class="form-group input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-comment-alt"></i></span>
</div>
<textarea name="msg" id="msg" class="form-control" placeholder="Write your message" cols="30" rows="4" required></textarea>
</div>
<div class="form-group">
<input type="submit" name="submit" id="submit" class="btn btn-primary btn-block" value="Send">
</div>
</form>
</div>
</div>
</div>
</body>
</html>