轻源码

  • QingYuanMa.com
  • 全球最大的互联网技术和资源下载平台
搜索
一起源码网 门户 ECShop网店 查看主题

ECSHOP新会员注册自动发送邮件通知管理员

发布者: dideming | 发布时间: 2018-10-27 15:51| 查看数: 3706| 评论数: 1|帖子模式

第一步:更改数据库
用MySQL管理工具找到 ecs_mail_templates表插入一条新会员注册邮件提醒模板数据。
  1. INSERT INTO ecs_mail_templates (template_id, template_code, is_html, template_subject, template_content, last_modify, last_send, type) VALUES(16, 'remind_of_new_reg', 1, '新会员注册提醒', '
  2. 亲爱的管理员,您好:快来看看吧,[url=http://www.qingyuanma.com/forum-43-1.html]ECSHOP[/url]模板屋又有新会员注册了。-----------------------------------------------------------------会员:{$user_name} 邮箱:{$email}管理中心登陆:http://www.qingyuanma.com/forum-43-1.html[url=http://www.qingyuanma.com/forum-43-1.html]ECSHOP模板[/url]屋小秘书提醒{$send_date}', 1330402034, 0, 'template');
复制代码
修改商店设置WAP设置选项卡的位置,在其之前增加选项卡“邮件设置”。
  1. UPDATE ecs_shop_config SET id=id+1 WHERE id=9;
  2. UPDATE ecs_shop_config SET id=id+100, parent_id=parent_id+1 WHERE parent_id=9;
  3. INSERT INTO eyo_shop_config (id, parent_id, code, type, store_range, store_dir, value, sort_order) VALUES
  4. (910, 9, 'send_reg_email', 'select', '1,0', '', '1', 1);
复制代码
将客服邮件地址输入框从网店信息选项卡移至邮件设置选项卡。
  1. UPDATE ecs_shop_config SET id=901 WHERE code="service_email";
复制代码
第二步: 更改语言文件。
/languages/zh_cn/admin/mail_template.php中添加:
  1. $_LANG['remind_of_new_reg'] = '新会员注册提醒模板';
复制代码
/languages/zh_cn/admin/shop_config.php中添加:

  1. $_LANG['cfg_desc']['service_email'] = '用于接收新订单提醒、新会员注册提醒等商城运营邮件,多个邮箱请用英文逗号分隔。';
  2. $_LANG['cfg_name']['send_reg_email'] = '新会员注册时是否给管理员发送邮件';
  3. $_LANG['cfg_range']['send_reg_email']['0'] = '不发送邮件';
  4. $_LANG['cfg_range']['send_reg_email']['1'] = '发送邮件';
  5. $_LANG['cfg_desc']['send_service_email'] = "商城信息中的客服邮件地址或管理员邮件地址不为空时,该选项有效。";
复制代码

第三步:增加PHP处理逻辑,flow.php和user.php中均有会员注册逻辑,所以这两个文件都要增加邮件提醒代码。
/flow.php中大概275行:if (register(trim($_POST[‘username’]), trim($_POST[‘password’]), trim($_POST[‘email’])))下增加:
  1. if (register(trim($_POST['username']), trim($_POST['password']), trim($_POST['email'])))
  2. {
  3.         /* 用户注册成功,如果需要,发邮件给管理员 */
  4.         if ($GLOBALS['_CFG']['send_reg_email'] == '1')
  5.         {
  6.                 $tpl = get_mail_template('remind_of_new_reg');
  7.                 $smarty->assign('shop_name', $_CFG['shop_name']);
  8.                 $smarty->assign('send_date', date($_CFG['time_format']));
  9.                 $smarty->assign('user_name', trim($_POST['username']));
  10.                 $smarty->assign('email', trim($_POST['email']));
  11.                 $content = $smarty->fetch('str:' . $tpl['template_content']);
  12.                 if($_CFG['service_email'] != '')
  13.                 {   
  14.                         //ECSHOP默认不支持多个邮件发送,将逗号分隔的邮件地址分解成数组,再循环逐个发送。
  15.                         $arrEmail = explode("," ,$_CFG['['service_email']);
  16.                         foreach($arrEmail as $arrEmailValue)
  17.                         {
  18.                                 send_mail($_CFG['shop_name'], $arrEmailValue, $tpl['template_subject'], $content, $tpl['is_html']); //发给管理员
  19.                         }
  20.                 }                    
  21.         }
  22.         ecs_header("Location: flow.php?step=consignee\n");
  23.         exit;
  24. }
复制代码

/user.php中约235行:
  1. /* 注册会员邮件确认通知 */
  2. $tpl = get_mail_template('send_reg');
  3. $smarty->assign('shop_name', $_CFG['shop_name']);
  4. $smarty->assign('send_date', date($_CFG['time_format']));
  5. $smarty->assign('user_name',$username);
  6. $content = $smarty->fetch('str:' . $tpl['template_content']);
  7. send_mail($_CFG['shop_name'], $email, $tpl['template_subject'], $content, $tpl['is_html']);
复制代码

下面增加:
  1. if (register(trim($_POST['username']), trim($_POST['password']), trim($_POST['email'])))
  2. {
  3.         /* 用户注册成功,如果需要,发邮件给客服和管理员 */
  4.         if ($GLOBALS['_CFG']['send_reg_email'] == '1')
  5.         {
  6.                 $tpl = get_mail_template('remind_of_new_reg');
  7.                 $smarty->assign('shop_name', $_CFG['shop_name']);
  8.                 $smarty->assign('send_date', date($_CFG['time_format']));
  9.                 $smarty->assign('user_name', trim($_POST['username']));
  10.                 $smarty->assign('email', trim($_POST['email']));
  11.                 $content = $smarty->fetch('str:' . $tpl['template_content']);
  12.                 if($_CFG['service_email'] != '')
  13.                 {
  14.                         //ECSHOP默认不支持多个邮件发送,将逗号分隔的邮件地址分解成数组,再循环逐个发送。
  15.                         $arrEmail = explode("," ,$_CFG['service_email']);
  16.                         foreach($arrEmail as $arrEmailValue)
  17.                         {
  18.                                 send_mail($_CFG['shop_name'], $arrEmailValue, $tpl['template_subject'], $content, $tpl['is_html']); //发给管理员
  19.                         }
  20.                 }                    
  21.         }
  22.         ecs_header("Location: flow.php?step=consignee\n");
  23.         exit;
  24. }
复制代码

最新评论

aplmm 发表于 2022-7-12 20:42
商户代码查询系统

浏览过的版块

轻源码让程序更轻更快

QingYuanMa.com

工作时间 周一至周六 8:00-17:30

侵权处理

客服QQ点击咨询

关注抖音号

定期抽VIP

Copyright © 2016-2021 https://www.171739.xyz/ 滇ICP备13200218号

快速回复 返回顶部 返回列表