-
Notifications
You must be signed in to change notification settings - Fork 2
/
Mailprocess.php
50 lines (34 loc) · 1.31 KB
/
Mailprocess.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
if(!class_exists('PHPMailer')) {
require('phpmailer/class.phpmailer.php');
require('phpmailer/class.smtp.php');
}
require_once("mail_configuration.php");
$result= $conn->query("SELECT * FROM user WHERE Email = '$Email' ");
$row = $result->fetch_assoc();
$Name = $row['Name'];
$mail = new PHPMailer();
$emailBody = "<div>" . $Name. ",<br><br><p>Click this link to recover your password<br><a href='" . PROJECT_HOME . "127.0.0.1/changepass.php?name=" . $Name . "'>" . PROJECT_HOME . "php-forgot-password-recover-code/reset_password.php?name=" . $Name . "</a><br><br></p>Regards,<br> Admin.</div>";
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = TRUE;
$mail->SMTPSecure = "tls";
$mail->Port = PORT;
$mail->Username = MAIL_USERNAME;
$mail->Password = MAIL_PASSWORD;
$mail->Host = MAIL_HOST;
$mail->Mailer = MAILER;
$mail->SetFrom(SERDER_EMAIL, SENDER_NAME); //from
$mail->AddReplyTo(SERDER_EMAIL, SENDER_NAME);//from
$mail->ReturnPath=SERDER_EMAIL;
$mail->AddAddress("$Email"); //to
$mail->Subject = "Forgot Password Recovery"; //subject
$mail->MsgHTML($emailBody);
$mail->IsHTML(true);
if(!$mail->Send()) {
$DB_error = "Problem in Sending Password Recovery Email";
} else {
$DB_error = "Please check your email to reset password!";
header( "Refresh:4; url=login.php" );
}
?>