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

吾爱主题 阅读:106 2021-09-16 15:55:00 评论:0

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

类库:

?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 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; } }

调用

?
1 2 3 4 5 6 $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' ; }

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

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

原文链接:https://www.cnblogs.com/jdhu/p/4264963.html

可以去百度分享获取分享代码输入这里。
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

【腾讯云】云服务器产品特惠热卖中
搜索
标签列表
    关注我们

    了解等多精彩内容