当前位置: 移动技术网 > IT编程>开发语言>PHP > PHP发送邮件确认验证注册功能示例【修改别人邮件类】

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

2020年03月09日  | 移动技术网IT编程  | 我要评论

本文实例讲述了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';
}

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

邮件类下载地址:

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网