1
我嘗試了很多網站,但是我找不到我想要做的結果。有人可以請幫我解決這個問題嗎?如何通過Gmail設置賬戶驗證超時?
我的問題是: 我想發送忘記密碼電子郵件至client.which在到期後的15 min.Here是我的代碼
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); } }
而且我也添加了這個代碼
//Send Welcome Email require_once("classes/class.phpmailer.php"); send_email($_POST["email"],"Thanks For Register", "Php Link is here");
超時並非您在電子郵件本身設置的內容,如果您希望鏈接在15分鐘內過期,您希望存儲創建的日期,並將有效性數據存儲在數據庫中,當有人點擊鏈接時,檢查當前日期是否早於有效日期,如果是,則拒絕重置,因爲它太舊了。 – zack6849