Home > CMS Tutorial > Empire CMS > How to notify the administrator of Empire CMS orders, feedback information, contributions and messages by email

How to notify the administrator of Empire CMS orders, feedback information, contributions and messages by email

silencement
Release: 2019-11-26 15:44:23
forward
2823 people have browsed it

How to notify the administrator of Empire CMS orders, feedback information, contributions and messages by email

The example in this article describes the method of notifying the administrator of Empire CMS orders, feedback information, submissions and messages by email. Share it with everyone for your reference. The specific implementation method is as follows:

1. Set the administrator's email address and sending parameters

Backend, system settings, system parameter settings

Basic attribute label: Administrator's email. Future notification emails will be sent to this mailbox

FTP/EMAIL tag: If the host supports the mail function, I personally feel that this may be more efficient. If the host does not support it, it doesn’t matter. You can also use SMTP and set it. The method is the same as the email client.

It should be noted that if you want to use a gmail account to send, it will be more troublesome to implement. Gmail's SMTP requires SSL, not to mention that the mail sending class that comes with Empire does not support SSL, which is where the mail is set up in the Empire's backend. There is no SSL option provided, so there is no need to worry about it. Just use your domestic email account to send it.

2. Add a new function to send emails to the administrator

Find e\class\SendEmail.inc.php and add the following code at the end:

Code 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 .= "\r\n\r\n此邮件由系统自动发出,请管理员尽快处理\n\r";
$sm=EcmsToSendMail($pr['email'],$subject,$msgtext);
return $sm;
}
Copy after login

It is recommended to study "Empire cms tutorial"

Third, send an email to the administrator. The following are different scenarios, which can be modified freely as needed.

1. When there is a new order

Modify e\enews\index.php, at about line 184

The code is as follows:

AddDd($_POST);

Add in front of this line:

The code is as follows:

@include("../class/SendEmail.inc.php");
SendNoticeToAdmin("有新订单!订单号".$_POST[ddno],$_POST);
Copy after login

Complete, this is just a reminder function, so there is no need for the email interface or anything like that. After considering it, the administrator can just go to the Empire backend to process it after receiving the email.

2. When there is a new submission

Modify e\class\qinfofun.php at about line 850

The code is as follows:

printerror("AddQinfoSuccess",$reurl,1);
Copy after login

Add in front of this line:

The code is as follows:

@include('SendEmail.inc.php');
SendNoticeToAdmin("收到来自".$add['title']."的投稿",$add);
Copy after login

3. When there is new information feedback:

Modify e\class\q_functions.php, at about line 468

The code is as follows:

$reurl=DoingReturnUrl("../tool/feedback/?bid=$bid",$add['ecmsfrom']);
Copy after login

Add in front of this line:

The code is as follows:

@include("SendEmail.inc.php");
SendNoticeToAdmin("收到来自".$add['title']."的信息反馈",$add);
Copy after login

4. When there is a new message

Modify e\enews\index.php, at about line 215

The code is as follows:

AddGbook($_POST);

Add in front of this line:

The code is as follows:

@include("../class/SendEmail.inc.php");
SendNoticeToAdmin("收到新留言",$_POST);
Copy after login

5. A member registers on the website (if the registration needs to be reviewed, receive this email for management Members can go to the backend for review in time)

Modify e\enews\index.php, at about line 74.

The code is as follows:

register($username,$password,$repassword,$email);
Copy after login

In front of this line Add:

The code is as follows:

@include('../class/SendEmail.inc.php');
SendNoticeToAdmin("新会员注册,用户名:".$username,$_POST);
Copy after login

6. E-mail verification is required to enable registration in the backend of the website. After the verification is passed, members will receive a welcome email. Since this email is for members, Therefore, we need to pay attention to the formatting of the content.

(1) Add a new file under e\class and name it user_template_register.txt. The content is as follows (for reference only, you can modify it yourself)

Welcome [!--USERNAME--] to register for this website.

(2) Modify e\class\qmemberfun.php, in about line 188

The code is as follows:

printerror('ActUserSuccess',$public_r['newsurl'],1);

Add in front of this line:

The code is as follows:

@include('SendEmail.inc.php');
$msgtext=file_get_contents("user_template_register.txt");
$msgtext=str_replace('[!--USERNAME--]',$r[username],$msgtext);
EcmsToSendMail($r[username],"欢迎注册",$msgtext);
Copy after login

Hope this article will be helpful to everyone’s Imperial CMS website building and secondary development.

The above is the detailed content of How to notify the administrator of Empire CMS orders, feedback information, contributions and messages by email. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:www.word666.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template