28,404
社区成员
发帖
与我相关
我的任务
分享
<%
'smtp为邮件服务器名
'user为smtp邮件服务器上的邮件地址
'pwd为smtp邮件服务器上的邮件的密码
'sendto为要发送的邮件地址
'from发件人名
'subject为主题
'body为邮件内容
function sendmail(smtp,sendto,from,user,pwd,subject,body)
Set jmail = Server.CreateObject("JMAIL.Message") '建立发送邮件的对象
jmail.silent = true '屏蔽例外错误,返回FALSE跟TRUE两值j
jmail.logging = true '启用邮件日志
'加上如下语句,否则还有可能出现乱码的可能性:
jmail.Charset = "GB2312" '邮件的文字编码为国标
jmail.ContentTransferEncoding = "base64"
jmail.Encoding = "base64"
jmail.ISOEncodeHeaders = false
'jmail.ContentType = "text/html" '邮件的格式为HTML格式 -- 有此句则发送附件时为乱码
jmail.AddRecipient sendto '邮件收件人的地址
jmail.From = from '发件人的E-MAIL地址
jmail.MailServerUserName = user '登录邮件服务器所需的用户名
jmail.MailServerPassword = pwd '登录邮件服务器所需的密码
jmail.Subject = subject '邮件的标题
jmail.Body = body '邮件的内容
'jmail.AddAttachment Server.MapPath("login.gif")'附件--不能有此句:jmail.ContentType = "text/html"
'Jmail.AddAttachment Server.MapPath("b.rar") '否则附件会变成乱码
jmail.Priority = 3 '邮件的紧急程序,1 为最快,5 为最慢, 3 为默认值
if jmail.send(smtp)=false then'执行邮件发送(通过邮件服务器地址)
sendmail=0
else
sendmail=1
end if
jmail.Close
end Function
'举例
smtp1="smtp.163.com"
user1="你的邮箱@163.com"
pwd1="邮箱的密码"
sendto1="要发送人的邮箱"
from1="你的邮箱@163.com" '要和user中的内容一样
subject1="邮件的主题"
body1="邮件内容"
t=sendmail(smtp1,sendto1,from1,user1,pwd1,subject1,body1)
if t=1 then
response.write "发送成功"
else
response.write "发送失败"
end if
%>
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/sqlin.asp"-->
<!--#include file="user/base64.asp"-->
<%
names=Checkstr(request("names"))
id=Checkstr(request("id"))
if id="" then
response.Write"错误,影片id丢失,发送失败,请与管理员联系。"
response.end
end if
address=request("address")
k=IsValidEmail(request("address"))
if k=true then
u_name=Checkstr(request.Cookies("u_name"))
u_name=deljs(u_name)
u_name=Base64decode(u_name)
if u_name<>""then
sql="select u_id from zt_user where [u_name] ='"+u_name+"'"
Call maxz.exec("",-1)
rs.open sql,conn,1,1
if rs.bof and rs.eof then
u_id=""
else
u_id=rs("u_id")
end if
end if
call maxz.conn_open
set rs=server.createobject("adodb.recordset")
rs.Open "select zt_id,zt_name,zt_type,zt_zy,zt_content from zt_data where zt_id="&id,conn,1,1
if rs.eof and rs.bof then
response.write "没有找到该影片或者已被删除,请检查影片id是否正确。"
else
zt_id=rs("zt_id")
zt_name=rs("zt_name")
zt_type=rs("zt_type")
if zt_type=1 then
zt_type="韩国"
zt_type1="hgj"
elseif zt_type=2 then
zt_type="日本"
zt_type1="rbj"
end if
zt_zy=rs("zt_zy")
s=deljs(rs("zt_content"))
s=replace(s,"<p>","")
s=replace(s,"</p>","")
s=replace(s,chr(10),"")
s=replace(s,chr(13),"<br>")
s=replace(s,chr(32)," ")
s=replace(s,chr(-24159),"<br>")
s=replace(s,""","""")
s=replace(s,"‘","""")
s=replace(s,"“","“")
s=replace(s,"”","”")
s=replace(s,"’","")
zt_content=s
end if
Email=address
subject="你的朋友"&names&"给你推荐了一部"&zt_type&"剧"
body="我现在正在看《"&zt_name&"》,觉得很好看,就推荐给你,有兴趣的话就看下吧,下面是该电视剧的介绍:<br><br>"
body=body&"影片名:"&zt_name&"<br>"
body=body&"类 型:"&zt_type&"电视剧<br>"
body=body&"演 员:"&zt_zy&"<br>"
'body=body&"在线播放地址:http://www.bbmoo.com/moviehtml/"&zt_type1&"_"&zt_id&".html<br>"
body=body&"观看地址:<a href=http://www.bbmoo.com/u_view.asp?url=moviehtml/"&zt_type1&"_"&zt_id&".html&uid="&u_id&">点击这里直接打开</a><br>"
body=body&"影片剧情介绍:"&zt_content&"<br><br>"
body=body&"<span style=""color:#0000FF"">上面地址保证安全无病毒,也没有弹窗和垃圾广告,请放心打开!</span>"
Set JMail = Server.CreateObject("JMail.Message")
JMail.Charset = "gb2312" ' 邮件字符集,默认为"US-ASCII"
JMail.ContentType = "text/html" '邮件的格式为HTML格式
JMail.From = "master@bbmoo.com" ' 发送者地址
JMail.FromName = "包谷猪日韩剧" ' 发送者姓名
JMail.Subject = subject ' 邮件主题
JMail.MailServerUserName = "master@bbmoo.com" '身份验证的用户名
JMail.MailServerPassword = "991260" ' 身份验证的密码
JMail.Priority = 1
'JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
JMail.AddRecipient(Email)
JMail.Body = body
JMail.Send("127.0.0.1")
JMail.Close()
Set JMail = Nothing
rs.close
conn.close
set rs=nothing
set conn=nothing
'response.Write endstr
response.Write"<script language=""javascript"" type=""text/javascript"">alert('邮件发送成功!');window.close();</script>"
else
response.write"你输入的地址:"&request("address")&" 是一个无效地址,请返回重新输入。<br><br>QQ邮箱格式为:QQ号码@qq.com,比如:41254874@qq.com"
end if
'response.End()
function IsValidEmail(email) '判断EMAIL格式是否有效的函数
dim names,name,i,c
IsValidEmail = true
names = Split(email, "@")
if UBound(names) <> 1 then
IsValidEmail = false
exit function
end if
for each name in names
if Len(name) <= 0 then
IsValidEmail = false
exit function
end if
for i = 1 to Len(name)
c = Lcase(Mid(name, i, 1))
if InStr("abcdefghijklmnopqrstuvwxyz_-.",c) <= 0 and not IsNumeric(c) then
IsValidEmail = false
exit function
end if
next
if Left(name, 1) = "." or Right(name, 1) = "." then
IsValidEmail = false
exit function
end if
next
if InStr(names(1), ".") <= 0 then
IsValidEmail = false
exit function
end if
i = Len(names(1)) - InStrRev(names(1),".")
if i <> 2 and i <> 3 then
IsValidEmail = false
exit function
end if
if InStr(email, "..") > 0 then
IsValidEmail = false
end if
end function
%>
<!--#include file="conn.asp"-->
<!-- #include file="check.asp" -->
<%
'邮件发送 for maxcms 1.0
'作者:二十三 论坛id:phuai
'QQ:41729015
'-----------------------------
Server.ScriptTimeout=3600 '超时1小时
Response.Buffer=True
response.Write"正在读取今日更新信息...<br><br>"
response.Flush()
Call maxz.exec("", -1)
set rs = server.createobject("adodb.recordset")
sql="select zt_id,zt_name,zt_type,zt_lz,new_date from zt_data where year(new_date)="&Year(date)&" and month(new_date)="&month(date)&" and day(new_date)="&day(date)&""
rs.open sql,conn,1,1
body=""
i=1
do while not rs.eof
zt_id=rs("zt_id")
zt_name=rs("zt_name")
zt_type=rs("zt_type")
if zt_type=1 then
typ="hgj"
elseif zt_type=2 then
typ="rbj"
end if
zt_lz=rs("zt_lz")
new_date=rs("new_date")
rs.movenext
body=body&i&"、<span style=""font-size:14px;font-weight:bold;"">"&zt_name&"</span> <span style=""font-size:12px;color:#458B00"">"&zt_lz&"</span> <a href=""http://www.bbmoo.com/moviehtml/"&typ&"_"&zt_id&".html"" target=""_blank""><span style=""font-size:12px;"">观看</span></a><br>"
i=i+1
loop
'response.write body
rs.close
conn.close
set rs=nothing
set conn=nothing
response.Write"信息读取完毕,开始发送邮件...<br><br>"
response.Flush()
call maxz.conn_open
set rs=server.createobject("adodb.recordset")
rs.Open "select u_mail from zt_mail order by u_id desc",conn,1,1
if rs.eof and rs.bof then
response.write "目前还没有人订阅,不用发送邮件。"
response.end()
else
y=month(now)
r=day(now)
do while not rs.eof
Email=rs("u_mail") '接收邮件人的邮件地址
subject="包谷猪-"&y&"月"&r&"日更新日韩剧列表" '邮件主题
info="你好,欢迎使用邮件订阅,以下是今日最新更新的日韩剧详细信息,请你查阅:<br><br>"
info=info&body&"<br><br>"
info=info&"本邮件无法回复,如有问题请发邮件至41729015@qq.com 同时也请你不要将本邮件举报为广告或垃圾邮件,如果你以后不想收到我们的邮件,请<a href=""http://www.bbmoo.com/mail/mail.html"" target=""_blank"">点击这里退订</a>即可,谢谢!<br><br>"
'info=info&"如果你觉得本网站不错,请告诉你周围的朋友。我们的地址:http://www.bbmoo.com ,QQ群:14872479 欢迎你的加入"
'response.Write info
'response.End()
Set JMail = Server.CreateObject("JMail.Message")
JMail.Charset = "gb2312" ' 邮件字符集,默认为"US-ASCII"
JMail.ContentType = "text/html" '邮件的格式为HTML格式
JMail.From = "master@bbmoo.com" ' 发送者地址
JMail.FromName = "包谷猪日韩剧" ' 发送者姓名
JMail.Subject = subject ' 邮件主题
JMail.MailServerUserName = "master@bbmoo.com" '身份验证的用户名
JMail.MailServerPassword = "991260" ' 身份验证的密码
JMail.Priority = 1
'JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
JMail.AddRecipient(Email)
JMail.Body = info
JMail.Send("127.0.0.1")
JMail.Close()
Set JMail = Nothing
rs.movenext
n=n+1
response.Write "向 "&Email&" 发送成功<br>"
response.flush
call Sleep(2) '延时4秒
loop
response.write"发送完毕,一共发送了"&n&"封邮件。<br>"
end if
rs.close
conn.close
set rs=nothing
set conn=nothing
Function Sleep(n) '单位秒s
Dim StartTime
StartTime = Timer
Do : Loop Until Timer>n+StartTime
End Function
%>
Server.ScriptTimeout=1000
Response.Buffer=True
response.Write"正在读取今日更新信息...<br><br>"
response.Flush()
Call maxz.exec("", -1)
set rs = server.createobject("adodb.recordset")
sql="select zt_id,zt_name,zt_type,zt_lz,new_date from zt_data where year(new_date)="&Year(date)&" and month(new_date)="&month(date)&" and day(new_date)="&day(date)&""
rs.open sql,conn,1,1
body=""
i=1
do while not rs.eof
zt_id=rs("zt_id")
zt_name=rs("zt_name")
zt_type=rs("zt_type")
if zt_type=1 then
typ="hgj"
elseif zt_type=2 then
typ="rbj"
end if
zt_lz=rs("zt_lz")
new_date=rs("new_date")
rs.movenext
body=body&i&"、<span style=""font-size:14px;font-weight:bold;"">"&zt_name&"</span> <span style=""font-size:12px;color:#458B00"">"&zt_lz&"</span> <a href=""http://www.bbmoo.com/moviehtml/"&typ&"_"&zt_id&".html"" target=""_blank""><span style=""font-size:12px;"">观看</span></a><br>"
i=i+1
loop
'response.write body
rs.close
conn.close
set rs=nothing
set conn=nothing
response.Write"信息读取完毕,开始发送邮件...<br><br>"
response.Flush()
call maxz.conn_open
set rs=server.createobject("adodb.recordset")
rs.Open "select u_mail from zt_mail order by u_id desc",conn,1,1
if rs.eof and rs.bof then
response.write "目前还没有人订阅,不用发送邮件。"
response.end()
else
y=month(now)
r=day(now)
do while not rs.eof
Email=rs("u_mail") '接收邮件人的邮件地址
subject="包谷猪-"&y&"月"&r&"日更新日韩剧列表" '邮件主题
info="你好,欢迎使用邮件订阅,以下是今日最新更新的日韩剧详细信息,请你查阅:<br><br>"
info=info&body&"<br><br>"
info=info&"本邮件无法回复,如有问题请发邮件至41729015@qq.com 同时也请你不要将本邮件举报为广告或垃圾邮件,如果你以后不想收到我们的邮件,请<a href=""http://www.bbmoo.com/mail/mail.html"" target=""_blank"">点击这里退订</a>即可,谢谢!<br><br>"
'info=info&"如果你觉得本网站不错,请告诉你周围的朋友。我们的地址:http://www.bbmoo.com ,QQ群:14872479 欢迎你的加入"
'response.Write info
'response.End()
Set JMail = Server.CreateObject("JMail.Message")
JMail.Charset = "gb2312" ' 邮件字符集,默认为"US-ASCII"
JMail.ContentType = "text/html" '邮件的格式为HTML格式
JMail.From = "master@bbmoo.com" ' 发送者地址
JMail.FromName = "包谷猪日韩剧" ' 发送者姓名
JMail.Subject = subject ' 邮件主题
JMail.MailServerUserName = "master@bbmoo.com" '身份验证的用户名
JMail.MailServerPassword = "991260" ' 身份验证的密码
JMail.Priority = 1
'JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
JMail.AddRecipient(Email)
JMail.Body = info
JMail.Send("127.0.0.1")
JMail.Close()
Set JMail = Nothing
rs.movenext
n=n+1
response.Write "向 "&Email&" 发送成功<br>"
response.flush
call Sleep(2) '延时4秒
loop
response.write"发送完毕,一共发送了"&n&"封邮件。<br>"
end if
rs.close
conn.close
set rs=nothing
set conn=nothing
Function Sleep(n) '单位秒s
Dim StartTime
StartTime = Timer
Do : Loop Until Timer>n+StartTime
End Function
%>