一般在采用dedecms做订单系统的时候,用户默认的订单提交都只能在后台看到的,因此每次都要登陆到后台去查看,非常的麻烦。本文讲解了如何将提交的订单直接发送到站长邮箱,分享给大家。
打开根目录plus下面的diy.php文件:
大概在85行找到代码:
$query = "INSERT INTO `{$diy->table}` (`id`, `ifcheck` $addvar) VALUES (NULL, 0 $addvalue); ";
在此代码后面开始加入代码:
$mailtitle = $name."ZZVIPS提交表单通知";
$mailbody = "称呼:{$name}\r\n邮箱:{$email}\r\n内容:{$message}";
$headers = $cfg_adminemail;
$mailtype = 'TXT';
require_once(DEDEINC.'/mail.class.php');
$smtp = new smtp($cfg_smtp_server,$cfg_smtp_port,true,$cfg_smtp_usermail,$cfg_smtp_password);
$smtp->debug = false;
$smtp->sendmail($cfg_smtp_usermail,$cfg_webname ,$cfg_smtp_usermail, $mailtitle, $mailbody, $mailtype);
$mailbody = "称呼:{$name}\r\n邮箱:{$email}\r\n内容:{$message}";
$headers = $cfg_adminemail;
$mailtype = 'TXT';
require_once(DEDEINC.'/mail.class.php');
$smtp = new smtp($cfg_smtp_server,$cfg_smtp_port,true,$cfg_smtp_usermail,$cfg_smtp_password);
$smtp->debug = false;
$smtp->sendmail($cfg_smtp_usermail,$cfg_webname ,$cfg_smtp_usermail, $mailtitle, $mailbody, $mailtype);
其中$mailbody = "称呼:{$name}\r\n邮箱:{$email}\r\n内容:{$message}";就是在自定义表单中添加自定义字段的名称和id。