thinkphp实现发送邮件密码找回功能实例,thinkphp密码找回
thinkphp实现发送邮件密码找回功能实例,thinkphp密码找回
本文实例讲述了thinkphp实现发送邮件密码找回功能的方法。分享给大家供大家参考。具体实现方法如下:
首先下载mail.class.php类文件,配置文件中定义下列参数:
复制代码 代码如下:
'MAIL_ADDRESS' => 'ivzhu@qq.com', // 邮箱地址
'MAIL_SMTP' => 'smtp.qq.com', // 邮箱SMTP服务器
'MAIL_LOGINNAME' => 'mail@qq.com', // 邮箱登录帐号
'MAIL_PASSWORD' => '123456', // 邮箱密码
'MAIL_CHARSET' => 'UTF-8', // 编码
'MAIL_AUTH' => true, // 邮箱认证
'MAIL_HTML' => true, // true HTML格式 false TXT格式
在tp项目org中放入mail.class.php,使用时候引入 import('@.ORG.Mail');
复制代码 代码如下:
public function index(){
import('@.ORG.Mail');
//SendMail('admin@waikucms.com','邮件标题','邮件正文','歪酷CMS管理员');
//解释下参数: 参数1---目标邮箱, 参数2----邮件标题,参数三--邮件正文,参数四---发件人名称;
$content=md5(time());
session($content,$content);
$content=C('localurl').'/index.php'.U('Mail/index',array('res'=>$content));
if(SendMail('aa@qq.com','nihao邮件标题',$content,'unphp')){
echo 'chengong';
}else{
echo 'shibai';
}
$this->display();
}
另一个页面接受参数res:
复制代码 代码如下:
public function index(){
header("Content-type: text/html; charset=utf-8");
$res=I('res');
echo $res;
if(session($res)==$res){
echo '密码找回成功';
session($res,null);
}else{
echo '已经过期';
}
}
希望本文所述对大家的ThinkPHP框架程序设计有所帮助。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











The Ouyi Exchange app supports downloading of Apple mobile phones, visit the official website, click the "Apple Mobile" option, obtain and install it in the App Store, register or log in to conduct cryptocurrency trading.

Sesame Open Door is a platform that focuses on cryptocurrency trading. Users can obtain portals through official websites or social media to ensure that the authenticity of SSL certificates and website content is verified during access.

To cancel a Binance account, you need to complete the following steps: 1) Ensure all asset transfers, 2) Cancel all pending orders, 3) Unlock API keys, 4) Close all open contracts; then log in to Binance official website, enter the "User Center", select "Account Logout", fill in the reason for the cancellation, confirm the asset transfer, submit an application and wait for review, confirm the cancellation after the review is passed, and the account cannot be restored after the cancellation.

Visit Binance official website and check HTTPS and green lock logos to avoid phishing websites, and official applications can also be accessed safely.

The download, installation and registration process of the Hong Kong Digital Currency Exchange app is very simple. Users can quickly obtain and use this app through the official app download link provided in this article. This article will introduce in detail how to download, install and register the Hong Kong Digital Currency Exchange app to ensure that every user can complete the operation smoothly.

Recommended top ten cryptocurrency apps in 2025: 1. OKX, 2. Binance, 3. Coinbase. 1. OKX ranks first with its powerful features and user-friendly interface, supporting a variety of transactions and staking services. 2. Binance ranks second with its huge user base and rich trading pairs, providing a variety of trading and IEO services. 3. Coinbase ranks third with its user-friendly interface and powerful security measures, supporting a variety of mainstream virtual currency transactions.

Top 10 virtual digital currency exchanges rankings: 1. OKX, 2. Binance, 3. Coinbase. 1. OKX ranks first with its powerful features and user-friendly interface, supporting a variety of transactions and staking services. 2. Binance ranks second with its huge user base and rich trading pairs, providing a variety of trading and IEO services. 3. Coinbase ranks third with its user-friendly interface and powerful security measures, supporting a variety of mainstream virtual currency transactions.

As the world's leading cryptocurrency exchange, Binance is always committed to providing users with a safe and convenient trading experience. Over time, Binance has continuously optimized its platform features and user interface to meet the changing needs of users. In 2025, Binance launched a new login portal aimed at further improving the user experience.
