对PHPMailer进行了一点小改造,使之能够使用在ThinkPHP 3.2中使用
将PHPMailer.class.php和Smtp.class.php这两个文件放入ThinkPHP/Library/Vendor文件夹下,然后在控制器中调用:use Vendor\PHPMailer;
函数使用:// 发送邮件<br>
public function sendEmail($content,$email){<br>
$mail = new PHPMailer();<br>
$body = $content;<br>
$mail->IsSMTP();<br>
$mail->SMTPAuth = true; // enable SMTP authentication<br>
$mail->SMTPKeepAlive = true; // sets the prefix to the servier<br>
$mail->CharSet = "utf-8"; // 解决乱码<br>
//send from 163 mail<br>
$mail->Host = "smtp.163.com"; // sets SMTP server<br>
$mail->Port = 25;<br>
$mail->Username = "your email@163.com"; // 用户账号<br>
$mail->Password = "your password"; // 用户密码<br>
$mail->From = "your emai@163.com";<br>
$mail->FromName = "管理员";<br>
$mail->Subject = "密码重置邮件(请勿回复)";<br>
$mail->AltBody = $body;<br>
$mail->WordWrap = 50; // set word wrap<br>
$mail->MsgHTML($body);<br>
$mail->AddReplyTo("your email@163.com","admin");<br>
// $mail->AddAttachment("attachment.jpg"); // 附件1<br>
// $mail->AddAttachment("attachment.zip"); // 附件2<br>
$mail->AddAddress($email,"accept"); //接收邮件的账号<br>
$mail->IsHTML(true); // send as HTML<br>
return $mail->Send();<br>
}
关于通过邮件找回密码的逻辑我就不写了,可移步我的博客http://blue7wings.com/2014/09/18/find-back-you-password-through-email/
PHPMailer.tar.gz
( 22.84 KB 下载:228 次 )
AD:真正免费,域名+虚机+企业邮箱=0元

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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Dreamweaver Mac version
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.