· 4 years ago · Dec 09, 2020, 02:28 PM
1<?php
2$title = 'Contact';
3include ('header.php');
4include ('application/config/email_config4.php');
5
6use PHPMailer\PHPMailer\PHPMailer;
7use PHPMailer\PHPMailer\Exception;
8
9require_once __DIR__ . '/vendor/autoload.php';
10require_once __DIR__ . '/vendor/phpmailer/phpmailer/class.phpmailer.php';
11require_once __DIR__ . '/vendor/phpmailer/phpmailer/src/PHPMailer.php';
12ini_set('display_errors',1); error_reporting(E_ALL);
13
14
15if(isset($_POST['submit'])) {
16 $userIP = $_SERVER["REMOTE_ADDR"];
17 $recaptchaResponse = $_POST['g-recaptcha-response'];
18 $secretKey = $yoursecretkey;
19 $request = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=xxxxxx");
20 if(!strstr($request, "true")){
21 echo '<div class="alert alert-danger" role="alert"><strong>Error!</strong>There was a problem with the Captcha, you lied to us! you are a robot! or you just didnt click it :)</div>';
22 }
23 else{
24 if(isset($_POST['submit']))
25 {
26 $message= '
27<!DOCTYPE html>
28<html lang="en">
29<head>
30<style type="text/css">
31@media only screen and (min-device-width: 601px) {
32 .content {
33 width: 600px !important;
34 }
35
36 .col425 {
37 width: 425px!important;
38 }
39
40 .col380 {
41 width: 380px!important;
42 }
43}
44@media only screen and (max-width: 550px), screen and (max-device-width: 550px) {
45 body[yahoo] .buttonwrapper {
46 background-color: transparent!important;
47 }
48
49 body[yahoo] .button a {
50 background-color: #e05443;
51 padding: 15px 15px 13px!important;
52 display: block!important;
53 }
54}
55</style>
56</head>
57<body yahoo="" bgcolor="#f6f8f1" style="margin: 0; padding: 0; min-width: 100%;">
58 <table width="100%" bgcolor="#f6f8f1" border="0" cellpadding="0" cellspacing="0">
59 <tr>
60 <td>
61 <table class="content" align="center" cellpadding="0" cellspacing="0" border="0" style="width: 100%; max-width: 600px;" width="100%">
62 <tr>
63 <td class="header" bgcolor="#f6f8f1" style="padding: 40px 30px 20px 30px;">
64 <img class="illustration" src="<?= echo site_url('') ?>" width="100%" height="100%" border="0" alt="" style="height: auto;">
65 </td>
66 </tr>
67 <td class="h2" style="color: #153643; font-family: sans-serif; font-size: 24px; line-height: 28px; font-weight: bold; padding: 5px 0 0 0;" align="center">Welcome '.$_POST['fullname'].'</td>
68 </table>
69 <table width="100%" border="0" cellspacing="0" cellpadding="0">
70 <tr>
71 </tr>
72 <div align="center">
73 <p>---- ---- ---- ---- ---- ---- ----</p>
74 </div>
75 <div class="container">
76 <div class="row" align="center">
77 <p>'.$_POST['comments'].'<br></p>
78 </div>
79 </div>
80 <div align="center">
81 <p>---- ---- ---- ---- ---- ---- ----</p>
82 </div>
83 </table>
84 </td></tr><tr>
85 <td class="footer" bgcolor="#f6f8f1" style="padding: 20px 30px 15px 30px;">
86 <table width="100%" border="0" cellspacing="0" cellpadding="0">
87 <div class="row copyright" align="center">
88 <div class="col-md-12 text-center">
89
90 <p> <small class="block">©<?php echo date("Y");?>Designed by <a href="https://xxxxxxxx" target="_blank">xxxxxxxx</a></small></p>
91 <p> <small class="block"></small></p>
92
93 <a href="https://www.facebook.com/"><img src="<?= echo site_url('') ?>" alt="" style="height: auto;"></a> 
94 <a href="#"><img src="<?= echo site_url('') ?>" alt="" style="height: auto;"></a> 
95 <a href="#"><img src="<?= echo site_url('') ?>" alt="" style="height: auto;"></a>
96 </div>
97 </div>
98 </table>
99 </td>
100 </tr>
101</table></body>
102</html>
103 ';
104 // Instantiate Class
105 $mail = new PHPMailer();
106 $mail->SMTPOptions = array ('ssl'=>array ('verify_peer'=>false,'verify_peer_name'=>false,'allow_self_signed'=>true));
107 $mail->SMTPDebug = 0;
108 // Set up SMTP
109 $mail->IsSMTP();
110 $mail->SMTPAuth = true;
111 $mail->SMTPSecure = "tls";
112 $mail->Host = "smtp.gmail.com";
113 $mail->Port = 587;
114 $mail->WordWrap = 80;
115 $mail->IsHTML(true);
116
117 // Authentication
118 $mail->Username = $senderEmail; // Your full Gmail address
119 $mail->Password = $senderPassword; // Your Gmail password
120 // $mail->Username = "xxxx@gmail.com";
121 // $mail->Password = "yyyyyyyyyy";
122
123 //
124 $fullname = $_POST['fullname'];
125 $foreign_email = $_POST['foreign_email'];
126 $subject = $_POST['subject'];
127 $comments = $_POST['comments'];
128
129 $Supervisor = 'qqqq@yahoo.it';
130 $email_addresses = array (
131 'postmaster' => 'postmaster@xxxx.example',
132 'gmail' => 'wwwwwww@gmail.com',
133 'hotmail' => 'qqqqqq@hotmail.com');
134
135 if (isset ($email_addresses [$_POST ['supervisor']])) {
136 $Supervisor = $email_addresses [$_POST ['supervisor']];}
137
138 // Compose
139 $mail->SetFrom($_POST['foreign_email'], $_POST['fullname']);
140 $mail->AddReplyTo($_POST['foreign_email'], $_POST['fullname']);
141 $mail->Subject = "$subject from $foreign_email"; // "New Enquiry from $foreign_email";
142 $mail->MsgHTML($message);
143
144
145 // Send To
146 $mail->AddAddress($Supervisor);//($receiverEmail, $receiverName); // Where to send it - Recipient
147 $mail->addCC('wwwwww@yahoo.it');//($address);
148 $mail->addBCC('qqqqqqq@hotmail.com');
149
150 // foreach ($_FILES["attachment"]["name"] as $k => $v) {
151 // $mail->AddAttachment( $_FILES["attachment"]["tmp_name"][$k], $_FILES["attachment"]["name"][$k] );
152 // }
153
154 $result = $mail->Send(); // Send!
155 $message = $result ? '<div class="alert alert-success" role="alert"><strong>Success! </strong> Message Sent Successfully!</div>' : '<div class="alert alert-danger" role="alert"><strong>Error!</strong>There was a problem delivering the message.</div>';
156 unset($mail);
157 }
158 }
159}
160?>
161 <div class="fusion-page-title-bar fusion-page-title-bar-breadcrumbs fusion-page-title-bar-left">
162 <div class="fusion-page-title-row">
163 <div class="fusion-page-title-wrapper">
164 <div class="fusion-page-title-captions">
165 <h1 class="entry-title"><?php echo 'Chiab_Gigi / ' .$title ?></h1>
166 </div>
167 <div class="fusion-page-title-secondary">
168 <div class="fusion-breadcrumbs">
169 <span><?php echo $title ?></span>
170 <span class="fusion-breadcrumb-sep">/</span>
171 <a href="index.php">Home</a>
172 <span class="fusion-breadcrumb-sep">/</span>
173 <a href="application/views/login.php">Login</a>
174 <span class="fusion-breadcrumb-sep">/</span>
175 <a href="main.php">*</a>
176 <!-- <span class="fusion-breadcrumb-sep">/</span>
177 <a href="#"> </a> -->
178 </div>
179 </div>
180 </div>
181 </div>
182 </div>
183 <!--==============================
184 Body
185 =================================-->
186
187 <div class="container-fluid" style="width:100%; max-width:600px">
188 <div class="col-sm-12">
189 <p><img src="assets/images/blank_05.png" class="img-fluid"></p>
190 </div>
191 <div class="panel panel-default">
192 <div class="panel-heading"><h4>Contact</h4></div>
193 <div class="panel-body">
194 <form method="post" name="form1" id="form1" action="" enctype="multipart/form-data">
195 <div class="container">
196 <div class="row">
197 <div class="col">
198 <div class="form-group md-form md-outline">
199 <label for="first_name">First Name</label>
200 <input type="text" name="first_name" id="tx1" class="form-control" pattern="[a-zA-Z ]+" required />
201 </div>
202 </div>
203
204 <div class="col">
205 <div class="form-group md-form md-outline">
206 <label for="last_name">Last Name</label>
207 <input type="text" name="last_name" id="tx2" class="form-control" onchange="myFunction(this.form);" pattern="[a-zA-Z ]+" required />
208 </div>
209 </div>
210 </div>
211
212 <div class="row">
213 <div class="col">
214 <div class="form-group md-form md-outline">
215 <label for="subject">Subject</label>
216 <input type="text" name="subject" id="subject" class="form-control" required />
217 </div>
218 </div>
219
220 <div class="col">
221 <div class="form-group md-form md-outline">
222 <label for="foreign_email">Your Email</label>
223 <input type="email" name="foreign_email" id="foreign_email" class="form-control" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$" required />
224 </div>
225 </div>
226 </div>
227
228 <div class="form-group shadow-textarea">
229 <label for="comments">Comments</label>
230 <textarea class="form-control z-depth-1" name="comments" id="comments" rows="3" placeholder=""></textarea>
231 </div>
232
233 <div class="row">
234 <div class="col">
235 <select class="mdb-select md-form" id="supervisor" name="supervisor">
236 <option color="#495057" value="">Choose Address</option>
237 <option value="postmaster">Postmaster</option>
238 <option value="gmail">Gmail</option>
239 <option value="hotmail">Hotmail</option>
240 </select>
241 </div>
242
243 <div class="col">
244 <div class="form-group ">
245 <?php echo '<div id="recaptcha" class="g-recaptcha" data-sitekey="'.$yourpublickey.'"
246 style="transorm:scale(0.77); -webkit-trasform:scale(0.77) transform-origin:0 0;
247 -webkit-trasform-origin:0 0;"></div>'; ?>
248
249 </div>
250 </div>
251 </div>
252
253 <div class="row">
254 <div class="col">
255 <input type="hidden" name="slug" id="tx4" class="form-control" />
256 <input type="hidden" name="fullname" id="tx3" class="form-control" />
257 </div>
258
259 <div class="col">
260
261 </div>
262
263 <div class="col">
264
265 </div>
266
267 <div class="col">
268 <div class="form-group">
269 <input type="submit" name="submit" value="Submit" class="btn btn-info">
270 </div>
271 </div>
272 </div>
273
274 </div>
275 <?php if(!empty($message)) echo $message; ?>
276 </form>
277 <?php
278
279 ?>
280 <div class="col-sm-12">
281 <p><img src="assets/images/blank.png"></p>
282 </div>
283
284 </div>
285 </div>
286 </div>
287<?php include ('footer.php'); ?>