asp发送邮件的问题。将所有满足条件分整合到一封邮件发送!
请问有谁能帮忙将满足条件的邮件内容弄成一封就将所有的完成啊?我现在满足条件的一个就发送一封,有所有满足的就会发送很多。请帮帮忙!真心感谢!谢谢!!
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!-- #include file="conn/conn.asp" -->
<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<title>Email</title>
</head>
<body>
<%
Function SendMail(MailtoAddress,MailtoName,Subject,MailBody,FromName,MailFrom)
'函数参数说明(收件人地址,收件人姓名(可选),主题,邮件内容,发件人姓名(可选),发件人地址)
'on error resume next
Dim JMail,MailServer,Flag
Set JMail=Server.CreateObject("JMail.Message")
If err Then
SendMail = False
err.clear
Exit Function
End if
JMail.Charset="gb2312" '邮件编码
JMail.silent=True
JMail.ContentType = "text/html" '邮件正文格式
MailServer = "smtp.163.com" '用来发送邮件的SMTP服务器
JMail.MailServerUserName = "18973247921@163.com" '登录用户名
JMail.MailServerPassWord = "zb369@" '登录密码
JMail.MailDomain = "163.com" '域名(如果用"name@domain.com"这样的用户名登录时,请指明domain.com),可选
JMail.AddRecipient MailtoAddress,MailtoName '收信人邮箱和收信人名称
JMail.Subject = Subject '主题
JMail.AppendHTML(MailBody)
JMail.FromName = FromName '发信人姓名
JMail.From = MailFrom '发信人Email
JMail.Priority = 3 '邮件等级,1为加急,3为普通,5为低级
Flag=JMail.Send(MailServer)
If Flag Then
SendMail=True
Else
SendMail=False
End If
JMail.Close
Set JMail=nothing
End Function
sql="select a.*,b.U_Email,b.U_Truename ,c.P_Code,c.P_Title from taskinfo a left join t_userinfo b on a.T_PrincipalID = b.u_id left join ProjectInfo c on P_ID=T_PID where T_State='1' "
set rs=DataToRsStatic(conn,sql)
while not rs.eof and not rs.bof
T_SDate=replace_back(rs("T_SDate"))
T_EDate=replace_back(rs("T_EDate"))
T_Percent=replace_back(rs("T_Percent"))
T_PrincipalID=replace_back(rs("T_PrincipalID"))
T_ManagerID=replace_back(rs("T_ManagerID"))
T_State=replace_back(rs("T_State"))
T_DatePercent=replace_back(rs("T_DatePercent"))
T_RealSDate=replace_back(rs("T_RealSDate"))
T_RealEDate=replace_back(rs("T_RealEDate"))
T_CreateDate=replace_back(rs("T_CreateDate"))
T_CreateUser=replace_back(rs("T_CreateUser"))
T_Jieduan=replace_back(rs("T_Jieduan"))
U_Email=replace_back(rs("U_Email"))
T_PCode=replace_back(rs("P_Code"))
T_PName=replace_back(rs("P_Title"))
name1=replace_back(rs("U_Truename"))
title=replace_back(rs("T_Title"))
t=datediff("d",T_Sdate,T_Edate)
'date3=DateAdd("d",1, T_Edate)
t1=datediff("d",T_Edate,date())
if t1>0 then
Call SendMail(U_Email,name1,"任务超期警示","<p><font color='red'size=4 ><b>任务超期警示</b></font></p>任务名称:"&title&"<br>任务负责人:"&name1&"<br>项目名称:("&T_PCode&")"&T_PName&"<br>计划结束时间:"&T_Edate&"<br>距任务计划结束时间<font color='red' size=5 ><b>超期"&t1&"天</b></font><br><p style='color:#F00'><b>注意:请尽