在member.app.php的register方法里添加相应代码
#发送站内信
$to_ids = array();
$to_ids[] = $user_id;
$msg_id = $ms->pm->send(MSG_SYSTEM, $to_ids, '站内信息标题', '站内信息内容');//MSG_SYSTEM表示系统消息
//发送邮件
$this->_mailto($email, '邮件标题', '邮件内容');
邮件验证登陆
第一步:在member.app.php 中找到register()函数, 在当post提交信息之后, 我们在其他用户信息验证都通过后, 发送一封电子邮件到用户email中。
//构造邮件激活码,
$word = $this->_rand();
$md5word = md5($word);
//将激活码写入刚增加的数据库
$user_mod =& m('member');
$user_mod->edit($user_id, array('last_login' => gmtime(), 'activation' => $md5word));//last_login 初始用于激活码时效限制
//取得邮件服务器信息 (邮件服务器信息预先在后台设置好,并检测是否发送成功)
$settinginfo = $this->get_emailinfo();
//取出单一服务器信息信息
$email_from = $settinginfo['site_name'];
$email_type = $settinginfo['email_type'];
$email_host = $settinginfo['email_host'];
$email_port = $settinginfo['email_port'];
$email_addr = $settinginfo['email_addr'];
$email_id = $settinginfo['email_id'];
$email_pass = $settinginfo['email_pass'];
$email_test = $email;
$email_subject = Lang::get('email_subject');
$email_content = '请点击下面的链接完成激活<a href=你的网址/index.php?app=member&act=login&do=activaled&r_uid='.$user_id.'&activationid='.$md5word. target="_blank">http://你的网址/index.php?app=member&act=login&do=activaled&r_uid='.$user_id.'&activation='.$md5word.'</a>如果不能点击链接,请复制地址并粘贴到浏览器的地址输入框激活后尽快删除此邮件,以免帐号信息泄漏欢迎您加入'.$settinginfo['site_name'].',<p>请妥善保管好您的帐号信息用户名:'.$user_name.'密码:'.$password.'如果忘记密码,可以到本站找回密码,也可以写信请管理员重新设定。';
/*使用mailer类发送激活邮件 */
import('mailer.lib');
$mailer = new Mailer($email_from, $email_addr, $email_type, $email_host, $email_port, $email_id, $email_pass);
$mail_result = $mailer->send($email_test, $email_subject, $email_content, CHARSET, 1);