-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdean_reject_mail.php
50 lines (44 loc) · 2.07 KB
/
dean_reject_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
50
<?php
session_start();
require 'dbconnect.php';
$email=$_SESSION['demail'];
$pass=$_POST['password'];
echo $email;
$mysqli->query("DELETE from dean where offemail='$email'");
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
//Load composer's autoloader
require 'vendor/autoload.php';
$mail = new PHPMailer(true); // Passing `true` enables exceptions
try {
//Server settings
$mail->SMTPDebug = 1; // 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 = '[email protected]'; // SMTP username
$mail->Password = $pass; // SMTP password
$mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465; // TCP port to connect to
//Recipients
$mail->setFrom("[email protected]");
// Add a recipient
$mail->addAddress($email);
// $mail->addAddress('[email protected]'); // Name is optional
//Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'ACCOUNT REJECTED';
$mail->Body = 'RESPECTED DEAN,<br>
YOUR DETAILS CANNOT BE VERIFIED DUE TO DISCREPANCIES IN YOUR DETAILS.YOU ARE REQUESTED TO SIGN UP AGAIN WITH PROPER DETAILS.<br><br>
REGARDS,';
$mail->AltBody = 'This is computer generated email please do not reply to it.';
$mail->send();
echo '<script>window.alert("Your mail has been sent");
window.location.href="web_profile.php";
</script>';
/* echo 'Message has been sent';//insert a pop up dialog box here
header("location: web_profile.php");*/
} catch (Exception $e) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
}