发送邮件确认验证注册,修改别人邮件类

类库image

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('[email protected]', '表白墙反馈');



        $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('[email protected]', 'aaa', '$row->txt', '$row->id');

        if ($result == true) {

            //更新状态

            echo 'ok';

        }

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

---------------------------------------美丽的分割线

多谢github开源项目许愿墙开发者。。。。

你可能感兴趣的:(发送邮件)