ASP怎样在提交表单到数据库的同时,再发邮件通知别人?
我想在点击提交时,洽谈记录的内容提交到数据库的同时,也以自己登录的账户MAIL(或固定一个MAIL账户也行)来发邮件通知"TO相关人"(TO相关人:这一栏可以输入1个或1...
我想在点击提交时,洽谈记录的内容提交到数据库的同时,也以自己登录的账户MAIL(或固定一个MAIL账户也行)来发邮件通知"TO相关人"
(TO 相关人:这一栏可以输入1个或1个以上的邮箱地址,若没输入地址则不发通知)
不好意思,本想将view.asp这页面的原代码全贴上来,但超过3000字只能复制以下一点了.高手可以告诉我你的QQ或MAIL吗.我以附件形式发给你.谢谢了!
*:我已安装了JMail组件.
<tr>
<td height="16" align="center" bgcolor="#999999" style="cursor: hand;" onClick="return showHideBlock('addRecords');"><span style="color: #FFFFFF; font-weight: bold;">[添加洽谈纪录]</span></td>
</tr>
<tr id="addRecords" style="display: block;">
<td height="1" bgcolor="#FFFFFF" style="padding: 10px;"> <table width="100%" border="0" cellspacing="0" cellpadding="3">
<form name="recordsForm" action="?action=saveRecords" method="post" onSubmit="return checkInput('rDate','recordsType','cId','rContent');">
<tr>
<td>添加洽谈纪录:</td>
</tr>
<tr>
<td>洽谈日期:
<input name="rDate" type="text" id="rDate3" value="<% = Date() %>" size="16" maxlength="12">
处理状况:
<% = getList(1,"baidu_recordsType",,"recordsType") %> <input name="cId" type="hidden" id="cId" value="<% = cId %>">
TO 相关人:
<input name="mailto" type="text" value=""></td>
</tr>
<tr>
<td valign="top">洽谈记录:
<textarea name="rContent" cols="90" rows="4" id="rContent"></textarea></td>
</tr>
<tr>
<td align="center"><input type="submit" name="Submit" value=" 提 交 ">
<input name="AddPlan" type="button" id="AddPlan" value=" 添加拜访计画 " onClick="openModalDialog('addPlan_records.asp?cId=<% = cId %>');"></td>
</tr>
</form>
</table></td>
</tr>
<tr>
<td height="16" align="center" bgcolor="#999999" style="cursor: hand;" onClick="return showHideBlock('listRecords');"><span style="color: #FFFFFF; font-weight: bold;">[洽谈纪录列表]</span></td>
</tr>
TO 1楼:你回答的我在网上找到过,但看不懂,怎么修改呢? 展开
(TO 相关人:这一栏可以输入1个或1个以上的邮箱地址,若没输入地址则不发通知)
不好意思,本想将view.asp这页面的原代码全贴上来,但超过3000字只能复制以下一点了.高手可以告诉我你的QQ或MAIL吗.我以附件形式发给你.谢谢了!
*:我已安装了JMail组件.
<tr>
<td height="16" align="center" bgcolor="#999999" style="cursor: hand;" onClick="return showHideBlock('addRecords');"><span style="color: #FFFFFF; font-weight: bold;">[添加洽谈纪录]</span></td>
</tr>
<tr id="addRecords" style="display: block;">
<td height="1" bgcolor="#FFFFFF" style="padding: 10px;"> <table width="100%" border="0" cellspacing="0" cellpadding="3">
<form name="recordsForm" action="?action=saveRecords" method="post" onSubmit="return checkInput('rDate','recordsType','cId','rContent');">
<tr>
<td>添加洽谈纪录:</td>
</tr>
<tr>
<td>洽谈日期:
<input name="rDate" type="text" id="rDate3" value="<% = Date() %>" size="16" maxlength="12">
处理状况:
<% = getList(1,"baidu_recordsType",,"recordsType") %> <input name="cId" type="hidden" id="cId" value="<% = cId %>">
TO 相关人:
<input name="mailto" type="text" value=""></td>
</tr>
<tr>
<td valign="top">洽谈记录:
<textarea name="rContent" cols="90" rows="4" id="rContent"></textarea></td>
</tr>
<tr>
<td align="center"><input type="submit" name="Submit" value=" 提 交 ">
<input name="AddPlan" type="button" id="AddPlan" value=" 添加拜访计画 " onClick="openModalDialog('addPlan_records.asp?cId=<% = cId %>');"></td>
</tr>
</form>
</table></td>
</tr>
<tr>
<td height="16" align="center" bgcolor="#999999" style="cursor: hand;" onClick="return showHideBlock('listRecords');"><span style="color: #FFFFFF; font-weight: bold;">[洽谈纪录列表]</span></td>
</tr>
TO 1楼:你回答的我在网上找到过,但看不懂,怎么修改呢? 展开
2个回答
展开全部
以这种方式会更方便,将提交的内容保存到一个表.然后每个用户登录时可弹出显示这个表的内容.
Sub saveEditData()
Dim cId
Dim rDate,rType,rContent,rUser,rUser2,rUser3,rUser4,rUser5,cUser
cId = CInt(ABS(Request("cId")))
cUser = Trim(Request("user"))
rDate = Request.Form("rDate")
rType = Request.Form("recordsType")
rContent = htmlEncode2(Request.Form("rContent"))
rUser = htmlEncode2(Request.Form("rUser"))
rUser2 = htmlEncode2(Request.Form("rUser2"))
rUser3 = htmlEncode2(Request.Form("rUser3"))
rUser4 = htmlEncode2(Request.Form("rUser4"))
rUser5 = htmlEncode2(Request.Form("rUser5"))
If Not IsNumeric(cId) Or cId <= 0 Or rType = "" Or Not IsDate(rDate) Or rContent = "" Then
Response.Write("<font color=""#FF0000""><b>资料请求错误。</b></font><br><br>")
Response.Write("<input type=""button"" value="" 返 回 "" onClick=""history.back();"">")
Else
Dim rs
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "Select Top 1 * From baidu_records",conn,3,2
rs.AddNew
rs("cId") = cId
rs("rDate") = rDate
rs("rType") = rType
rs("rContent") = rContent
rs.Update
rs.Close
If request("rUser") = "" Then
set rs=Nothing
Response.Redirect("view.asp?cId=" & cId)
Else
rs.Open "Select Top 1 * From baidu_messages",conn,3,2
rs.AddNew
rs("cId") = cId
rs("cUser") = cUser
rs("rDate") = rDate
rs("rType") = rType
rs("rContent") = rContent
rs("rUser") = rUser
rs.Update
rs.Close
If request("rUser2") = "" Then
set rs=Nothing
Response.Redirect("view.asp?cId=" & cId)
Else
rs.Open "Select Top 1 * From baidu_messages",conn,3,2
rs.AddNew
rs("cId") = cId
rs("cUser") = cUser
rs("rDate") = rDate
rs("rType") = rType
rs("rContent") = rContent
rs("rUser") = rUser2
rs.Update
rs.Close
If request("rUser3") = "" Then
set rs=Nothing
Response.Redirect("view.asp?cId=" & cId)
Else
rs.Open "Select Top 1 * From baidu_messages",conn,3,2
rs.AddNew
rs("cId") = cId
rs("cUser") = cUser
rs("rDate") = rDate
rs("rType") = rType
rs("rContent") = rContent
rs("rUser") = rUser3
rs.Update
rs.Close
If request("rUser4") = "" Then
set rs=Nothing
Response.Redirect("view.asp?cId=" & cId)
Else
rs.Open "Select Top 1 * From baidu_messages",conn,3,2
rs.AddNew
rs("cId") = cId
rs("cUser") = cUser
rs("rDate") = rDate
rs("rType") = rType
rs("rContent") = rContent
rs("rUser") = rUser4
rs.Update
rs.Close
If request("rUser5") = "" Then
set rs=Nothing
Response.Redirect("view.asp?cId=" & cId)
Else
rs.Open "Select Top 1 * From baidu_messages",conn,3,2
rs.AddNew
rs("cId") = cId
rs("cUser") = cUser
rs("rDate") = rDate
rs("rType") = rType
rs("rContent") = rContent
rs("rUser") = rUser5
rs.Update
rs.Close
Set rs = Nothing
Response.Redirect("view.asp?cId=" & cId)
End If
End If
End If
End If
End If
End If
End Sub
Sub saveEditData()
Dim cId
Dim rDate,rType,rContent,rUser,rUser2,rUser3,rUser4,rUser5,cUser
cId = CInt(ABS(Request("cId")))
cUser = Trim(Request("user"))
rDate = Request.Form("rDate")
rType = Request.Form("recordsType")
rContent = htmlEncode2(Request.Form("rContent"))
rUser = htmlEncode2(Request.Form("rUser"))
rUser2 = htmlEncode2(Request.Form("rUser2"))
rUser3 = htmlEncode2(Request.Form("rUser3"))
rUser4 = htmlEncode2(Request.Form("rUser4"))
rUser5 = htmlEncode2(Request.Form("rUser5"))
If Not IsNumeric(cId) Or cId <= 0 Or rType = "" Or Not IsDate(rDate) Or rContent = "" Then
Response.Write("<font color=""#FF0000""><b>资料请求错误。</b></font><br><br>")
Response.Write("<input type=""button"" value="" 返 回 "" onClick=""history.back();"">")
Else
Dim rs
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "Select Top 1 * From baidu_records",conn,3,2
rs.AddNew
rs("cId") = cId
rs("rDate") = rDate
rs("rType") = rType
rs("rContent") = rContent
rs.Update
rs.Close
If request("rUser") = "" Then
set rs=Nothing
Response.Redirect("view.asp?cId=" & cId)
Else
rs.Open "Select Top 1 * From baidu_messages",conn,3,2
rs.AddNew
rs("cId") = cId
rs("cUser") = cUser
rs("rDate") = rDate
rs("rType") = rType
rs("rContent") = rContent
rs("rUser") = rUser
rs.Update
rs.Close
If request("rUser2") = "" Then
set rs=Nothing
Response.Redirect("view.asp?cId=" & cId)
Else
rs.Open "Select Top 1 * From baidu_messages",conn,3,2
rs.AddNew
rs("cId") = cId
rs("cUser") = cUser
rs("rDate") = rDate
rs("rType") = rType
rs("rContent") = rContent
rs("rUser") = rUser2
rs.Update
rs.Close
If request("rUser3") = "" Then
set rs=Nothing
Response.Redirect("view.asp?cId=" & cId)
Else
rs.Open "Select Top 1 * From baidu_messages",conn,3,2
rs.AddNew
rs("cId") = cId
rs("cUser") = cUser
rs("rDate") = rDate
rs("rType") = rType
rs("rContent") = rContent
rs("rUser") = rUser3
rs.Update
rs.Close
If request("rUser4") = "" Then
set rs=Nothing
Response.Redirect("view.asp?cId=" & cId)
Else
rs.Open "Select Top 1 * From baidu_messages",conn,3,2
rs.AddNew
rs("cId") = cId
rs("cUser") = cUser
rs("rDate") = rDate
rs("rType") = rType
rs("rContent") = rContent
rs("rUser") = rUser4
rs.Update
rs.Close
If request("rUser5") = "" Then
set rs=Nothing
Response.Redirect("view.asp?cId=" & cId)
Else
rs.Open "Select Top 1 * From baidu_messages",conn,3,2
rs.AddNew
rs("cId") = cId
rs("cUser") = cUser
rs("rDate") = rDate
rs("rType") = rType
rs("rContent") = rContent
rs("rUser") = rUser5
rs.Update
rs.Close
Set rs = Nothing
Response.Redirect("view.asp?cId=" & cId)
End If
End If
End If
End If
End If
End If
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
那么仔细了还不晓得。。。啊啊,还有比我懒的人娃。
开个玩笑。
开个玩笑。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询