Home > Article > CMS Tutorial > The Empire CMS mall system implements the function of sending order email reminders after online payment.
This article describes the example of the Imperial CMS mall system's function of sending order email reminders after online payment. Share it with everyone for your reference, the details are as follows:
Empire CMS is a powerful content management system, and its mall function is also very powerful. When a user places an order and pays, how do we know that a user has placed an order? Because we can't be in the background of the website all the time, constantly refreshing the page to see if there are orders. The most common way is to use emails to remind us that someone has placed an order.
How to achieve this function?
The first step: Configure the Empire backend system settings - System parameter settings - FTP/EMAIL Configure EMAIL here
Generally use 126 mailboxes, my configuration is as follows:
Email sending Mode: SMTP module sends
SMTP server: smtp.126.com
SMTP port: write any one, I wrote 25
Sender address: write email address , such as jitaxiong@sina.cn
The name of the sender: just write a
Whether login verification is required: click "Yes"
Email login user name: Email user name , such as webmaster (excluding @126.com)
Email login password:
After the configuration is completed, set the administrator email (in the system settings) and save it.
Recommended to study "Empire cms tutorial"
The second step is to modify the source file. There are two ways
(1), e/class /ShopSysFun.php search code printerror($mess,$location,1);
Add the following code to the previous line:
The code is as follows:
$email=array('jitaxing@sina.cn'); $subject='邮件标题'; $content='邮件内容'; @include(ECMS_PATH.'e/class/SendEmail.inc.php'); EcmsToSendMail($email,$subject,$content);
Modify That's it. The email sent by this method can only serve as a reminder and does not contain the relevant content of the order. The title and content are fixed.
(2) This method can include part of the order The content and steps are as follows:
1. Add a new function to send emails to the administrator
Find eclassSendEmail.inc.php and add the following code at the end:
The code is as follows:
//给管理员信箱发送通知邮件新增函数 function SendNoticeToAdmin($subject,$body){ global $empire,$dbtbpre; $empire=new mysqlquery(); $pr=$empire->fetch1("select email from {$dbtbpre}enewspublic limit 1″); if(is_array($body)){ foreach($body as $value){ $key=key($body); next($body); $msgtext .= "$key:"."$value"."n"; } }else{ $msgtext=$body; } $msgtext .= "rnrn此邮件由系统自动发出,请管理员尽快处理nr"; $sm=EcmsToSendMail($pr['email'],$subject,$msgtext); return $sm; }
2. Modify eenewsindex.php, in about line 184
AddDd($_POST); add:
in front of this line:
The code is as follows:
@include("../class/SendEmail.inc.php"); SendNoticeToAdmin("有新订单!订单号".$_POST[ddno],$_POST);### I hope this article will be helpful to everyone’s website construction based on Empire CMS. ###
The above is the detailed content of The Empire CMS mall system implements the function of sending order email reminders after online payment.. For more information, please follow other related articles on the PHP Chinese website!