首页 » 二次开发 » 阅读文章

为ECSHOP添加注册发送邮件的功能

2010-12-21 16:32 12608 3 发表评论
标签:

第一步: 从数据库入手 用mysql管理工具找到 ecs_mail_templates  表插入一条 注册发送邮件的数据
INSERT INTO `ecs_mail_templates` (`template_id`, `template_code`, `is_html`, `template_subject`, `template_content`, `last_modify`, `last_send`, `type`) VALUES
(”, ‘send_reg’, 0, ‘注册确认’, ‘{$user_name}您好!<br>\r\n<br>\r\n   恭喜你注册为www.xaphp.com会员\r\n\r\n{$shop_name}\r\n{$send_date}’, 1228373714, 0, ‘template’);
template_content  是邮件发邮件内容字段 根据自己的需要编辑不同的内容 当然等你添加成功后 去后台邮件模板管理可以去做管理编辑。
第二步: 在语言文件加入一行记录 找languages/zh_cn/admin/mail_template.php 打开 添加 $_LANG[‘send_reg’] = ‘注册确认模板’;
第三步:修改注册文件 打开 user.php 找到
if (register($username, $password, $email, $other) !== false)
{
show_message(sprintf($_LANG[‘register_success’], $username . “$user->ucdata”), $_LANG[‘profile_lnk’], ‘user.php’, ‘info’, true);
}

在160行左右 修改为
    if (register($username, $password, $email, $other) !== false)
    {
 
 
        $tpl = get_mail_template(‘send_reg’);
        $smarty->assign(‘shop_name’, $_CFG[‘shop_name’]);
        $smarty->assign(‘send_date’, date($_CFG[‘time_format’]));
       $smarty->assign(‘user_name’,$username);
        $content = $smarty->fetch(‘str:’ . $tpl[‘template_content’]);
        send_mail($_CFG[‘shop_name’], $email, $tpl[‘template_subject’], $content, $tpl[‘is_html’]);

        show_message(sprintf($_LANG[‘register_success’], $username . “$user->ucdata”), $_LANG[‘profile_lnk’], ‘user.php’, ‘info’, true);
    }

改完毕注册测试 去邮箱查看 是否有新邮件袄 ,前提是你的网站要可以发送邮件。

本文地址:http://www.jwzzsw.com/archives/666.html

文章作者:思悟
版权所有 © 转载时请以链接形式注明作者和原始出处!

评论 共3条 (RSS 2.0) 发表评论

  1. liangkun说道:

    已更新链接。嘿,

  2. bird说道:

    请问怎么确认我的网站可以发送邮件呢

    • 思悟说道:

      你的网站要配置好邮件相关信息,“ECSHOP 管理中心 – 邮件服务器设置”(用QQ邮箱来测试吧),这要就可以发邮件了

发表评论

联系我 Contact Me

回到页首