广告位 后台主题配置管理 |
广告位 后台主题配置管理 |
本篇文章给大家谈谈zblog评论回复邮件,以及对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。
我现在这里没有z-blog程序,不然就帮你找下了,应该不难找的吧,评论的功能好像单独划分了一个模块出来的,在主题那个文件夹里有个html模板,文件名我忘了。
试试以下代码:核心就是循环调用发邮件代码就可以了
%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%
%
Server.ScriptTimeOut=9999999
Response.Buffer = True
dim FoundErr, ErrMsg, Action
dim MailServerUserName, MailServerPassWord, MailDomain, MailServer
dim MailtoAddress, MailtoName, Subject, MailBody, FromName, MailFrom, Priority
FoundErr = False
ErrMsg = ""
Action = Trim(Request("action"))
ComeUrl = ""
%
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
HTML
HEAD
TITLE群发邮件系统/TITLE
META http-equiv=Content-Type content="text/html; charset=gb2312"
META content="Microsoft FrontPage 4.0" Name=GENERATOR
STYLE type=text/css
a {text-decoration: none;} /* 链接无下划线,有为underline */
a:link {color: #000000;text-decoration: none;} /* 未访问的链接 */
a:visited {color: #000000;text-decoration: none;} /* 已访问的链接 */
a:hover {color: #ff6600;text-decoration: none;} /* 鼠标在链接上 */
a:active {color: #000000;text-decoration: none;} /* 点击激活链接 */
TD {
FONT-SIZE: 18px; COLOR: #000000; FONT-FAMILY: '宋体';LINE-HEIGHT: 150%;
}
BODY {
FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: '宋体'
}
INPUT {
FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: '宋体'
}
SELECT {
FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: '宋体'
}
.title
{
background:#0DB432;
color: #ffffff;
font-weight: normal;
}
.border
{
border: 1px solid #0DB432;
}
.tdbg{
background:#f0f0f0;
line-height: 120%;
}
.tdbg1{
background:#A3E2B1;
line-height: 120%;
}
/STYLE
/HEAD
BODY text=#000000 bgColor=#ffffff leftMargin=0 topMargin=0
br
%
Select Case Action
Case "send"
Call sendMail()
Case Else
Call Main()
End Select
If FoundErr = True Then
Response.Write WriteErrMsg(ErrMsg, ComeUrl,"错误信息")
End If
Response.write"/BODY/HTML"
sub main()
If Not IsObjInstalled("JMail.Message") Then
FoundErr=True
ErrMsg = "服务器不支持JMail组件,请正确安装"
Exit Sub
End If
%
form action="wssf.asp?Action=send" method=post
table width="80%" class="qnphp840d-5baa-f9e2-5197 border" border="0" cellspacing="1" cellpadding="4" align="center" height="589"
tr
td height="40" colspan="2" align="center" class="qnphp5baa-f9e2-5197-27a3 title"
pb 群发邮件系统/b/p /td
/tr
tr
td width='30%' class='qnphp1157-559f-6ea2-e861 tdbg1' height="25"strong邮件服务器地址:/strong /td
td class='qnphp559f-6ea2-e861-6478 tdbg' height="25"
input name='MailServer' type='text' id='MailServer' value='smtp.163.com' size='40' FONT color=#ff0000*/FONT
/td
/tr
tr
td width='30%' class='qnphp6ea2-e861-6478-7ca0 tdbg1' height="25"strong登录用户名一:/strong
/td
td class='qnphpe861-6478-7ca0-ceae tdbg' height="25"
input name='MailServerUserName1' type='text' id='MailServerUserName1' value='XXX' size='40' FONT color=#ff0000*/FONT
/td
/tr
tr
td width='30%' class='qnphp6478-7ca0-ceae-ff71 tdbg1' height="25"strong登录密码一:/strong
/td
td class='qnphp7ca0-ceae-ff71-7d55 tdbg' height="25"
input name='MailServerPassWord1' type='password' id='MailServerPassWord1' value='***' size='40' FONT color=#ff0000*/FONT
/td
/tr
tr
td width="30%" class="qnphpf9e2-5197-27a3-aaec tdbg1" height="25"您的姓名:/td
td class="qnphp0f27-2224-1157-559f tdbg" height="25"input name="name" type=text id="name" size=30
FONT color=#ff0000*/FONT/td
/tr
tr
td width="30%" class="qnphp2224-1157-559f-6ea2 tdbg1" height="25"您的E-mail:/td
td class="qnphp1157-559f-6ea2-e861 tdbg" height="25"input name="email" type=text id="email" value="XXX@163.com" size=30
FONT color=#ff0000*/FONT/td
/tr
tr
td width="30%" class="qnphp559f-6ea2-e861-6478 tdbg1" height="25"收件人姓名:/td
td class="qnphp6ea2-e861-6478-7ca0 tdbg" height="25"input name="toname" type=text id="toname" size=30
FONT color=#ff0000*/FONT/td
/tr
tr
td width="30%" class="qnphpe861-6478-7ca0-ceae tdbg1" height="25"收件人Email:/td
td class="qnphp6478-7ca0-ceae-ff71 tdbg" height="25"input name="toemail" type="text" id="toemail" size="30" maxlength="100"
FONT color=#ff0000*/FONT/td
/tr
tr
td width="30%" class="qnphp7ca0-ceae-ff71-7d55 tdbg1" height="25"邮件标题:/td
td class="qnphpceae-ff71-7d55-381d tdbg" height="25"input type=text name="topic" size=30
FONT color=#ff0000*/FONT/td
/tr
tr
td width="30%" class="qnphpff71-7d55-381d-840d tdbg1" height="500"邮件内容:/td
td class="qnphp7d55-381d-840d-5baa tdbg" height="500"textarea name="body" cols=74 rows=34 id="body"/textarea
FONT color=#ff0000*/FONT/td
/tr
tr
td width="30%" class="qnphp381d-840d-5baa-f9e2 tdbg" height="27"/td
td height=27 class="qnphp840d-5baa-f9e2-5197 tdbg"
input type="Submit" value="发送邮件" name="Submit"
input type="reset" name="Clear" value="重新填写"
/td
/tr
/table
/form
%
End Sub
Sub sendMail()
MailServer = trim(Request("MailServer")) 'SMTP服务器地址:smtp.163.com, 请修改
MailServerUserName = trim(Request("MailServerUserName")) 'SMTP登录用户名:XXX@163.com, 请修改
MailServerPassWord = trim(Request("MailServerPassWord")) 'SMTP登录密码:***, 请修改,注意大小写
MailDomain = trim(Request("MailDomain")) 'SMTP域名:163.com, 请修改
FromName = trim(Request("name")) '发件人名字
MailFrom = trim(Request("email")) '发件人邮箱
MailtoName = trim(Request("toname")) '发件人名字
MailtoAddress=trim(Request("toemail")) '收件人邮箱
Subject = trim(Request("topic"))
MailBody = trim(Request("body"))
Priority=3
If FromName="" or MailFrom="" or MailtoName="" or Subject="" or MailBody="" then
FoundErr = True
ErrMsg = "请填写完整每一项信息!"
Exit Sub
End If
ErrMsg = JSendMail()
If ErrMsg"" Then
FoundErr = True
Exit Sub
Else
Response.Write WriteErrMsg("", ComeUrl,"成功信息")
End If
End Sub
Function JSendMail()
On Error Resume Next
JSendMail = ""
Dim JMail,tempMessage
Set JMail = Server.CreateObject("JMail.Message")
JMail.silent=true
JMail.Logging = True
JMail.Charset = "gb2312" '邮件编码
JMail.silent = True
JMail.ContentType = "text/html" '邮件正文格式
JMail.ServerAddress=MailServer '用来发送邮件的SMTP服务器
'如果服务器需要SMTP身份验证则还需指定以下参数
JMail.MailServerUserName = MailServerUserName1 '登录用户名
JMail.MailServerPassWord = MailServerPassWord1 '登录密码
JMail.AddRecipient MailtoAddress, MailtoName '收信人
JMail.Subject = Subject '主题
JMail.HtmlBody = MailBody '邮件正文(HTML格式)
JMail.Body = MailBody '邮件正文(纯文本格式)
JMail.FromName = FromName '发信人姓名
JMail.From = MailFrom '发信人Email
JMail.Priority = Priority '邮件等级,1为加急,3为普通,5为低级
Dim emailArray
If MailtoAddress="" then
set fsObj = Server.CreateObject("Scripting.FileSystemObject")
FilePath = Server.MapPath("email.txt")
set txtsObj = fsObj.OpenTextFile(FilePath, 1, false)
i = 0
Do While Not txtsObj.atEndOfStream
emailArray(i)=txtsObj.ReadLine
JMail.AddRecipient Trim(emailArray(i)),MailtoName
i=i+1
loop
Else
JMail.AddRecipient MailtoAddress, MailtoName
End If
JMail.Send (MailServer)
tempMessage = JMail.ErrorMessage
JMail.Close
Set JMail = Nothing
If tempMessage"" then
FoundErr = True
JSendMail = tempMessage
end if
Set JMail = Nothing
End Function
Function IsObjInstalled(strClassString)
On Error Resume Next
IsObjInstalled = False
Err = 0
Dim xTestObj
Set xTestObj = CreateObject(strClassString)
If Err.Number = 0 Then IsObjInstalled = True
Set xTestObj = Nothing
Err = 0
End Function
Function WriteErrMsg(sMsg, sComeUrl,Massages)
Dim strMsg
strMsg = strMsg "htmlheadtitle"Massages"/titlemeta http-equiv='Content-Type' content='text/html; charset=gb2312'" vbCrLf
strMsg = strMsg "/headbodybrbr" vbCrLf
strMsg = strMsg "table cellpadding=2 cellspacing=1 border=0 width=400 class='qnphpceae-ff71-7d55-381d border' align=center" vbCrLf
strMsg = strMsg " tr align='center' class='qnphpff71-7d55-381d-840d title'td height='22'strong"Massages"/strong/td/tr" vbCrLf
if FoundErr=True Then
strMsg = strMsg " tr class='qnphp7d55-381d-840d-5baa tdbg'td height='100' valign='top'b产生错误的可能原因:/b" sMsg "/td/tr" vbCrLf
Else
strMsg = strMsg " tr class='qnphp381d-840d-5baa-f9e2 tdbg'td height='100' valign='top'brb恭喜,成功用JMail发送邮件!/b" sMsg "/td/tr" vbCrLf
End If
strMsg = strMsg " tr align='center' class='qnphp840d-5baa-f9e2-5197 tdbg'td"
If sComeUrl "" Then
strMsg = strMsg "a href='javascript:history.go(-1)' 返回上一页/a"
Else
strMsg = strMsg "a href='javascript:window.close();'【关闭】/a"
End If
strMsg = strMsg "/td/tr" vbCrLf
strMsg = strMsg "/table" vbCrLf
strMsg = strMsg "/body/html" vbCrLf
WriteErrMsg = strMsg
End Function
%
在评论里应该有回复按钮的,点击按钮就可以直接回复了。如果你的没有就是你zblog主题模板没有添加相关代码!!
应该是你留言板的模板文件中删除了一部分调用代码,我记得上次也出现了这样的情况,在zblog仿站乐园里面找到了答案,你可以去参考学习下的。。
想收到新评论时给站长发邮件,首先得你主机支持邮件接收,并且是否已经开启过?
然后在你的主题文件functions.php的代码最后添加以下代码
?php
/* 评论邮件通知 */
function comment_mail_notify($comment_id){
$comment = get_comment($comment_id);
$parent_id = $comment-comment_parent ? $comment-comment_parent : '';
$spam_confirmed = $comment-comment_approved;
if(($parent_id != '') ($spam_confirmed != 'spam')){
$wp_email = 'webmaster@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));
$to = trim(get_comment($parent_id)-comment_author_email);
$subject = '你在 [' . get_option("blogname") . '] 的留言有了回应';
$message = '
div style="background-color:#eef2fa; border:1px solid #d8e3e8; color:#111; padding:0 15px; -moz-border-radius:5px; -webkit-border-radius:5px; -khtml-border-radius:5px;"
p' . trim(get_comment($parent_id)-comment_author) . ', 你好!/p
p你曾在《' . get_the_title($comment-comment_post_ID) . '》的留言:br /'
. trim(get_comment($parent_id)-comment_content) . '/p
p' . trim($comment-comment_author) . ' 给你的回应:br /'
. trim($comment-comment_content) . 'br //p
p你可以点击 a href="' . htmlspecialchars(get_comment_link($parent_id)) . '"查看回应完整内容/a/p
pstrong感谢你对 a href="' . get_option('home') . '" target="_blank"' . get_option('blogname') . '/a 的关注,欢迎a href="' . get_option('home') . '/feed/" target="_blank"订阅本站/a/strong/p
pstrong您可以直接回复此邮件与我联系~/strong/p
/div';
$from = "From: \"" . get_option('blogname') . "\" $wp_email";
$headers = "$from\nContent-Type: text/html; charset=" . get_option('blog_charset') . "\n";
wp_mail( $to, $subject, $message, $headers );
}
}
add_action('comment_post', 'comment_mail_notify');
?
关于zblog评论回复邮件和的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。
广告位 后台主题配置管理 |
广告位 后台主题配置管理 |