PHP发送邮件确认验证注册功能示例【修改别人邮件类】

yipeiwu_com6年前PHP代码库

本文实例讲述了PHP发送邮件确认验证注册功能。分享给大家供大家参考,具体如下:

类库:

require "class.phpmailer.php";
require "class.smtp.php";
class PHP_Mailer
{
 protected $mail;
 public function __construct()
 {
  $mail = new PHPMailer;
  $mail->SMTPDebug = 3;       
  $mail->isSMTP();         
  $mail->SMTPAuth = true;       
  $mail->isHTML(true); 
  $CI =& get_instance();
  $CI->load->config('email_config');
  $email = $CI->config->item('email');
  foreach ($email as $key => $value) {
   $mail->$key = $value;
  }
  $this->mail = $mail;
 }
 public function check_user($email,$nick,$txt,$id)
 {
  $this->mail->FromName = '表白墙';
  $this->mail->addAddress("$email");  // Add a recipient
  $this->mail->addReplyTo('test@test.com', '表白墙反馈');
  $this->mail->Subject = '表白墙通知';
  $this->mail->CharSet = "UTF-8";
  $this->mail->Body = <<<body
<p>你好:测试邮件
body;
  $this->mail->AltBody = <<<altbody
你好:
有一个altbody说:谢谢许愿墙的程序员 敬上! altbody; if ($this->mail->send()) { returntrue; } elsereturnfalse; } }

调用

$this->load->library('email/php_mailer');
$result = $this->php_mailer->check_user('297538600@qq.com', 'aaa', '$row->txt', '$row->id');
if ($result == true) {
 //更新状态
 echo 'ok';
}

待完善接收邮件验证的功能

邮件类下载地址:https://www.jb51.net/codes/27188.html

更多关于PHP相关内容感兴趣的读者可查看本站专题:《PHP网络编程技巧总结》、《PHP基本语法入门教程》、《PHP数组(Array)操作技巧大全》、《php字符串(string)用法总结》、《PHP运算与运算符用法总结》、《php+mysql数据库操作入门教程》及《php常见数据库操作技巧汇总

希望本文所述对大家PHP程序设计有所帮助。

相关文章

php使用strip_tags()去除html标签仍有空白的解决方法

本文实例讲述了php使用strip_tags()去除html标签仍有空白的解决方法。分享给大家供大家参考,具体如下: $subject = strip_tags($newsRs['c...

php UTF-8、Unicode和BOM问题

php UTF-8、Unicode和BOM问题

一、介绍 UTF-8 是一种在web应用中经常使用的一种 Unicode 字符的编码方式,使用 UTF-8 的好处在于它是一种变长的编码方式,对于 ANSII 码编码长度为1个字节,这样...

浅谈apache和nginx的rewrite的区别

1. Nginx Rewrite规则相关指令 Nginx Rewrite规则相关指令有if、rewrite、set、return、break等,其中rewrite是最关键的指令。一个简...

php str_pad 函数用法简介

语法 str_pad(string,length,pad_string,pad_type) 参数 描述 string 必需。规定要填充的字符串。 length 必需。规定新字符串的长度。...

两个开源的Php输出Excel文件类

1.php-excel php-excel is a very simple library for generating excel documents from php on-the...