search
Homephp教程php手册PHPMailer 命名空间版

对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元

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

mPDF

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

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

MinGW - Minimalist GNU for Windows

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.