sendmail.asp

来自「网站的后台管理代码......内容比较全面....新手比较适合」· ASP 代码 · 共 56 行

ASP
56
字号
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../inc/adconn.asp"-->
<!--#include file="../css.asp"-->
<% set rs=server.CreateObject("adodb.recordset") %>
<%
if session("admin_name")="" then 
response.end
end if%>
<html>
<body>
<%
' 取得表单资料
jid=request.form("id")
jname = Request.Form("jname")
jto = Request.Form("jto")
jfrom=request.form("jfrom")
jpass=request.form("jpass")
jserver=request.form("jserver")
jtitle=request.form("jtitle")
jcontent=request.form("jcontent")
jcontent2=request.form("jcontent2")
other=request.Form("other")
if jto <>"" and jfrom <>"" and jcontent<>"" then ' 建立 JMail 组件
set msg = Server.CreateOBject("JMail.Message") ' 设定将寄信的过程记录下来
msg.Logging = true
msg.silent = true ' 中文编码设定
msg.Charset = "gb2312"


' 将表单资料存入组件中
msg.From = jfrom
msg.FromName = jname
' smtp认证的关键
msg.mailserverusername=jfrom '邮箱账户,需完整地址
msg.mailserverpassword=jpass '输入你的邮箱密码 
msg.AddRecipient jto ' 将收信人的资料加入组件
msg.Subject = jtitle ' 设定信件的主题
msg.body = jcontent & jcontent2' 设定信件的主体内容
if not msg.Send(jserver) then'送出表单资料为电子邮件 ,并指定发信服务器 SMTP
Response.write "<pre>" & msg.log & "</pre>"
else
Response.write "信件成功寄出,谢谢您的留言!!"
Response.write "<a href=javascript:history.go(-1)>返回</a>"
conn.execute "update guestbook set g_hfmsg='"&jcontent&"' where id="& jid
Response.write "<script language=javascript>window.opener.location.reload();</script>"
end if
msg.Close
set msg=nothing
else 
response.write "请将内容填写完整!!"
end if
%>

</body>
</html>
 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?