-
Notifications
You must be signed in to change notification settings - Fork 0
/
Mail.php
49 lines (43 loc) · 1.61 KB
/
Mail.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
<?php
echo !extension_loaded('openssl')?"Not Available":"Available";
echo "<br/>";
$Name = $_POST['name'];
$Email = $_POST['email'];
$Subject = $_POST['subject'];
$Message = $_POST['message'];
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
//Load composer's autoloader
require '../PHPMailer/src/Exception.php';
require '../PHPMailer/src/PHPMailer.php';
require '../PHPMailer/src/SMTP.php';
$mail = new PHPMailer;
$mail->SMTPDebug = 2; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'testwebnew123@gmail.com'; // SMTP username
$mail->Password = '123testweb'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587;
$mail->setFrom('febrik1996@gmail.com', 'Mailer');
$mail->addAddress('febrik1996@gmail.com', 'Febrik');
$mail->Subject = $Subject;
$mail->Body = $Message;
if(!$mail->send()){
?>
<script language="JavaScript">
alert("Something not going right!");
document.location='http://localhost/ContactPage/';
history.go(1);
</script>
<?php
}else{
?>
<script language="JavaScript">
alert("Your Message has been succesfully sent!");
document.location='http://localhost/ContactPage/';
</script>
<?php
}
?>