-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontact.php
207 lines (179 loc) · 8.25 KB
/
contact.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<!-- PHP Start -->
<?php
// Import PHPMailer classes into the global namespace
// These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'PHPMailer/src/Exception.php';
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';
require 'source/session.php';
if(isset($_POST["email"]))
{
$emailTo = 'fahimuddin900@gmail.com';
$emailFrom = $_POST["email"];
$message = $_POST["message"];
$name = $_POST["name"];
$subject = $_POST["subject"];
// Instantiation and passing `true` enables exceptions
$mail = new PHPMailer(true);
try {
//Server settings
$mail->isSMTP(); // Send using SMTP
$mail->Host = 'smtp.stackmail.com'; // Set the SMTP server to send through
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'support@explorebd.tech'; // SMTP username
$mail->Password = 'explorebd311'; // SMTP password
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
$mail->Port = 587; // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above
//Recipients
$mail->setFrom('support@explorebd.tech', 'ExploreBD');
$mail->addAddress("$emailTo"); // Add a recipient
$mail->addReplyTo("$emailFrom", "$name");
// Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = "$subject";
$mail->Body = " <h1>Message Body</h1>
<p>$message</P>";
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mail->send();
$_SESSION['success'] = "Message Sent";
header('location: contact.php');
} catch (Exception $e) {
$_SESSION['success'] = "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
header('location: contact.php');
}
exit();
}
?>
<!-- PHP End -->
<!-- HTML Start -->
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&display=swap" rel="stylesheet">
<!-- Font Awesome -->
<script src="https://kit.fontawesome.com/a1f6d66f7f.js" crossorigin="anonymous"></script>
<!-- Bootstrap CSS -->
<link rel="stylesheet" type="text/css" href="asssets/css/bootstrap/bootstrap.min.css" crossorigin="anonymous">
<!-- Animate CSS -->
<link rel="stylesheet" type="text/css" href="asssets/css/animate/animate.min.css">
<!-- Custom Css -->
<link rel="stylesheet" type="text/css" href="asssets/css/custom/style.css">
<title>ExploreBD.</title>
</head>
<body>
<!-- Header Section Start -->
<header>
<!-- Nav Section Start -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container">
<!-- Logo Start -->
<a class="navbar-brand logo" href="index.html">ExploreBD.</a>
<!-- Logo End -->
<!-- Toggle Button -->
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<!-- Toggle Button -->
<!-- Nav Bar Start -->
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav ml-auto">
<a class="nav-item nav-link" href="aboutus.html">About Us</a>
<a class="nav-item nav-link" href="contact.php">Contact</a>
<a class="nav-item nav-link" href="login.php">Sign In</a>
</div>
</div>
<!-- Nav Bar End -->
</div>
</nav>
<!-- Nav Section End -->
<!-- Form Section Start -->
<div class="container" style="height:88vh;">
<div class="row h-100">
<div class="col-md-3"></div>
<div class="col-md-6">
<h3 class="text-center my-4">GET IN TOUCH</h3>
<?php
if(isset($_SESSION['success']) && $_SESSION['success'] != '')
{
echo '<h4 class="bg-success text-white p-1"> '.$_SESSION['success'].'</h4>';
unset($_SESSION['success']);
}
if(isset($_SESSION['status']) && $_SESSION['status'] != '')
{
echo '<h4 class="bg-danger text-white p-1">'.$_SESSION['status'].'</h4>';
unset($_SESSION['status']);
}
?>
<form method="POST">
<div class="form-group my-4">
<label for="formGroupExampleInput" class="mb-2">Your Name</label>
<input type="text" name="name" class="form-control" id="formGroupExampleInput" placeholder="Enter Name" required>
</div>
<div class="form-group my-4">
<label for="exampleInputEmail1" class="mb-2">Email address</label>
<input type="email" name="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email" required>
<small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
</div>
<div class="form-group my-4">
<label for="formGroupExampleInput" class="mb-2">Subject</label>
<input type="text" name="subject" class="form-control" id="formGroupExampleInput" placeholder="Enter Subject" required>
</div>
<div class="form-group my-4">
<label for="exampleFormControlTextarea1" class="mb-2">Your Message</label>
<textarea class="form-control" name="message" id="exampleFormControlTextarea1" rows="4"></textarea>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
<div class="col-md-3"></div>
</div>
</div>
<!-- Form Section End -->
</header>
<!-- Header Section End -->
<div class="footer-section py-5 bg-dark"">
<div class="container">
<div class="row">
<div class="col-md-4 ">
<a class="navbar-brand footer-logo" href="#">ExploreBD.</a>
</div>
<div class="col-md-4">
<p class="my-3">Links</p>
<a class="d-block my-1" href="aboutus.html">About Us</a>
<a class="d-block my-1" href="contact.php">Contact</a>
<a class="d-block my-1" href="login.php">Sign In</a>
</div>
<div class="col-md-4">
<p class="my-3">Social</p>
<div class="social-links">
<ul class="h-100 d-flex align-items-center">
<li><p>Follow On : </p></li>
<li><a href="facebook.com"><i class="fab fa-facebook-square"></i></a></li>
<li><a href="twitter.com"><i class="fab fa-twitter-square"></i></a></li>
<li><a href="instagram.com"><i class="fab fa-instagram-square"></i></a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<footer class="p-3 bg-dark" style="border-top: 1px solid #959595;">
<div class="container text-center">
<p>Copyright © <a href="index.html">ExploreBD.</a> 2020</p>
</div>
</footer>
<!-- App.js -->
<script src="asssets/js/app.js"></script>
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="asssets/js/jquery/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>
<script src="asssets/js/bootstrap/bootstrap.min.js"></script>
</body>
</html>
<!-- HTML END -->