📄 send.asp
字号:
<%
On error resume next
if Request.ServerVariables("Request_Method")="POST" then
Id = Request("id")
set conn=server.createobject("ADODB.Connection")
filepath=server.mappath("db.mdb")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & filepath
Set RS = SERVER.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM music where id=" & Cint(Id)
RS.Open strSQL,conn,1,1
Dim JMail, contentId
Set JMail = Server.CreateObject("JMail.Message")
JMail.Charset = "gb2312" ' 邮件字符集,默认为"US-ASCII"
' JMail.ISOEncodeHeaders = False ' 是否进行ISO编码,默认为True
JMail.From = "afei_pal@163.com"
JMail.FromName = Request("from")
JMail.Subject = "你的好友:" & Request("from") & "给你点了一首歌"
JMail.MailServerUserName = "afei_pal"
JMail.MailServerPassword = "hpf5047332"
JMail.Priority = 3
JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
' 加入一个收件人【变量email:收件人地址】可以同一语句重复加入多个
JMail.AddRecipient Request("mailto")
' 加入附件【变量filename:附件文件的绝对地址,确保用户IUSR_机器名有访问的权限】
' 【参数设置是(True)否(False)为Inline方式】
'contentId = JMail.AddAttachment (Server.MapPath("jmail.asp"), True)
JMail.HTMLBody = "<html><head><META content=zh-cn http-equiv=Content-Language><meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312""><style type=text/css>A:link { FONT-SIZE: 9pt; TEXT-DECORATION: none; color: #000000}A:visited {FONT-SIZE: 9pt; TEXT-DECORATION: none; color: #666666}A:hover {COLOR: #ff6600; FONT-SIZE: 9pt; TEXT-DECORATION: underline}BODY {FONT-SIZE: 9pt} --></style></head><body><font color=red>亲爱的" & Request("to") & ":</font><br><font color=green><b>" & Request("body") & "。<br>送你一首<a href=" & RS("url") & ">" & RS("name") & "的" & RS("song") & "</a>,希望你能够喜欢。</b><br><font color=red>好友:" & Request("from") & ":" & Request("mailfrom") & "</font><br><br><b>更多音乐请点击</b>:<a href=http://mmp3.ku.net>http://mmp3.ku.net</a></body></html>"
JMail.Body = "我们的邮件采用了HTML格式,但是您的邮件查看软件可能不支持。。。邮件正文,邮件正文,邮件正文"
JMail.Send("smtp.163.com")
JMail.Close()
Set JMail = Nothing
if err.number<>0 then
response.write "发送发送失败!"
else
response.write "邮件发送成功!"
end if
end if
%>
<html>
<head>
<LINK href="style.css" rel=stylesheet type=text/css>
<title>凭歌寄语</title>
</head>
<body>
<center>
<form method="POST">
<table width="400" height="250" border=0 cellpadding=0 cellspacing=0>
<tr>
<td>好友姓名:</td><td><input type="text" name="to" size="10"></td><td>好友信箱:</td><td><input type="text" name="mailto" size="20"></td>
</tr>
<tr>
<td>您的姓名:</td><td><input type="text" name="from" size="10"></td><td>您的信箱:</td><td><input type="text" name="mailfrom" size="20"></td>
</tr>
<tr>
<td colspan="4">祝福:<br><textarea name="body" cols="50" rows="5"></textarea></td>
</tr>
<tr>
<td colspan="4"><input type="submit" value="提交"> <input type="reset" value="重 置"></td>
</tr>
</table>
</form>
</center>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -