I tried many site but I can't find the result what I want to do.so anybody can please help me to solve this ?
My problem is :
I want to send forgot password email to client.which is expire after 15 min.Here is my code
function send_email($to, $subject, $message)
{
global $from_email;
global $from_pwd;
global $host;
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->ContentType = "text/html";
$mail->Host = $host;
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Username = $from_email;
$mail->Password = $from_pwd;
$mail->From = $from_email;
$mail->AddAddress($to);
$mail->Subject = $subject;
$mail->Body = $message;
if(!$mail->Send()) {
die('Message was not sent.'.$mail->ErrorInfo);
}
}
And I also Added This code
//Send Welcome Email
require_once("classes/class.phpmailer.php");
send_email($_POST["email"],"Thanks For Register", "Php Link is here");
Answer
There are so many ways to achieve this like:
- While sending the email make an entry in the datatabse table with the time on email send and put the check to compare the time with given time limit and show the message if time exceeds.
- Send an extra pramater in the link that contains timestamp or encrypted time in it, compare it with the time of clicked time and show the message.
No comments:
Post a Comment