本文实例讲述了帝国CMS实现反馈信息内容发送到邮箱的方法。分享给大家供大家参考。具体实现方法如下:
帝国CMS修改步骤:
1.文件修改e/enews/index.php 找到如下代码,上方加入如下代码:
//trylife add for feedmail
elseif($enews=='AddFeedback'){
include('../class/q_functions.php');
include('../class/SendEmail.inc.php');
include('../trylife/Mail/FeedMail.php');
}
//trylife add for feedmail
elseif($enews=='AddFeedback'){
include('../class/q_functions.php');
include('../class/SendEmail.inc.php');
include('../trylife/Mail/FeedMail.php');
}
2.文件上传 FeedMail.php 文件上传到 e/trylife/Mail/,如无此文件夹请建立.
3.FeedMail.php文件代码示例:
<?php
/***********************************************************************************
代码示例:(假设反馈字段为以下四个字段)
标题:title
姓名:name
电话:call
内容:saytext
*************************************************************************************/
//取得IP地址
$ip=egetip();
//需要发送的邮箱
//$email='123456789@qq.com';
//多邮件示例
$email=array("123456789@qq.com","trylife@qq.com","987654321@qq.com");
//$subject为邮件标题
$subject='[Service.trylife.cn信息反馈]'.$_POST['title'];
//$text为邮件内容 {$_POST['title']}为反馈字段中title字段内容 以此类推
$text="
标题:{RepPostVar($_POST['title'])}
姓名:{RepPostVar($_POST['name'])}
电话:{RepPostVar($_POST['call'])}
<b>内容:</b>
{$_POST['saytext']}
IP:$ip";
//执行发信
$sm=EcmsToSendMail($email,$subject,$text);
?>
other1.发件人修改 e/class/SendEmail.inc.php
这个是修改发件人的EMAIL是反馈者留的邮箱地址,方便回复邮件到反馈人的邮箱.
//$mailer->From=$r['fromemail'];
if($_POST['email']){
$mailer->From=$_POST['email'];
}
else{
$mailer->From=$r['fromemail'];
}
//$mailer->FromName=$r['emailname'];
if($_POST['name']){
$mailer->FromName=$_POST['name'];
}
else{
$mailer->FromName=$r['emailname'];
}
//$mailer->From=$r['fromemail'];
if($_POST['email']){
$mailer->From=$_POST['email'];
}
else{
$mailer->From=$r['fromemail'];
}
//$mailer->FromName=$r['emailname'];
if($_POST['name']){
$mailer->FromName=$_POST['name'];
}
else{
$mailer->FromName=$r['emailname'];
}
//2010-06-17 防止字符过滤不严被利用 需要修改上述代码
里面
$_POST['字段']这样的改为
RepPostVar($_POST['字段'])
希望本文所述对大家的帝国CMS建站有所帮助。