您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

PHPMailer 命名空间版

2024/3/26 19:07:40发布17次查看
对phpmailer进行了一点小改造,使之能够使用在thinkphp 3.2中使用
将phpmailer.class.php和smtp.class.php这两个文件放入thinkphp/library/vendor文件夹下,然后在控制器中调用:use vendor\phpmailer;
函数使用:// 发送邮件
    public function sendemail($content,$email){
        $mail             = new phpmailer();
        $body = $content;
        $mail->issmtp();
        $mail->smtpauth   = true;                     // enable smtp authentication
        $mail->smtpkeepalive = true;                  // sets the prefix to the servier
        $mail->charset = utf-8;                      // 解决乱码
        //send from 163 mail
        $mail->host       = smtp.163.com;           // sets smtp server
        $mail->port       = 25;
        $mail->username   = your email@163.com;     // 用户账号
        $mail->password   = your password;                 // 用户密码
        $mail->from       = your emai@163.com;
        $mail->fromname   = 管理员;
        $mail->subject    = 密码重置邮件(请勿回复);
        $mail->altbody    = $body;
        $mail->wordwrap   = 50;                       // set word wrap
        $mail->msghtml($body);
        $mail->addreplyto(your email@163.com,admin);
        // $mail->addattachment(attachment.jpg);             // 附件1
        // $mail->addattachment(attachment.zip);             // 附件2
        $mail->addaddress($email,accept);     //接收邮件的账号
        $mail->ishtml(true); // send as html
        return $mail->send();
    }关于通过邮件找回密码的逻辑我就不写了,可移步我的博客http://blue7wings.com/2014/09/18/find-back-you-password-through-email/
phpmailer.tar.gz ( 22.84 kb 下载:228 次 )
ad:真正免费,域名+虚机+企业邮箱=0元
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product