send.asp
资源名称:imail.rar [点击查看]
上传用户:lwb168
上传日期:2021-10-31
资源大小:722k
文件大小:3k
源码类别:
Email服务器
开发平台:
ASP/ASPX
- <!--#include file="conn.asp"-->
- <%
- sql="select email,email_pass,email_pop,name,title from mail where id="&request("id")
- rs.open sql,conn,1,2
- temp_email=rs("email")
- temp_email_pass=rs("email_pass")
- temp_email_pop=rs("email_pop")
- temp_name=rs("name")
- temp_title=rs("title")
- rs.close
- 'IJOB邮件群发系统 作者:IJOB 修改:阿标
- Server.ScriptTimeout=10000
- 'session("ijob_cishu")=""
- 'session("ijob_i")=""
- if session("ijob_cishu")="" then
- session("ijob_cishu")=0
- end if
- if session("ijob_i")="" then
- session("ijob_i")=1
- end if
- function FSOlinedit(filename,lineNum)
- if linenum < 1 then exit function
- dim fso,f,temparray,tempcnt
- set fso = server.CreateObject("scripting.filesystemobject")
- if not fso.fileExists(server.mappath(filename)) then exit function
- set f = fso.opentextfile(server.mappath(filename),1)
- if not f.AtEndofStream then
- tempcnt = f.readall
- f.close
- set f = nothing
- temparray = split(tempcnt,chr(13)&chr(10))
- if lineNum>ubound(temparray)+1 then
- exit function
- else
- FSOlinedit = temparray(lineNum-1)
- end if
- end if
- end function
- '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ''设置邮件参数
- filename="dizhi.txt" '邮件地址列表
- dim mailname,mailpass,mailform,mailsmtp
- mailname=temp_email '有效电子邮件帐号,有的邮件服务器需要的是ekeer2001@sohu.com等这种格式的帐号,出错后请调整这些!
- mailpass=temp_email_pass '有效电子邮件密码
- mailform=temp_email '发信邮件地址,必须和SMTP相对应起来
- mailsmtp=temp_email_pop 'smtp服务器
- dim m_strHTML,Jmail,m_fso,m_tf,filepath,jingyanshuoming,photo,bj1,bj2
- '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ''计算文件行数
- Set m_fso = Server.CreateObject("SCRIPTING.FILESYSTEMOBJECT")
- filepath=server.mappath(filename)
- Set m_tf = m_fso.OpenTextFile(filepath, 1)
- m_strHTML = m_tf.ReadAll
- bac = m_tf.line
- Set m_tf = Nothing
- Set m_fso = Nothing
- '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ''读取文件并发送邮件
- Set m_fso = Server.CreateObject("SCRIPTING.FILESYSTEMOBJECT")
- filepath=server.mappath("1.htm")
- Set m_tf = m_fso.OpenTextFile(filepath, 1)
- m_strHTML = m_tf.ReadAll
- Set m_tf = Nothing
- Set m_fso = Nothing
- cishu=bac/20
- 'i=session("ijob_i")
- i=session("ijob_cishu")*20
- Response.Write "执行第<font color=#ff0000>"&session("ijob_cishu")&"</font>次<br>"
- Response.Write "邮件总数:"&bac&"<br>"
- Response.Write "需要执行:"&cishu&"<br>"
- Response.Write ""&d&"<br>"
- for i=i to i+19
- Set Jmail=server.createobject("Jmail.Message")
- abcd=FSOlinedit(filename,i)
- Response.Write "<font color=#ff0000>"&i&"</font>+"&abcd&"<br>"
- Jmail.Charset = "gb2312"
- JMail.ContentType = "text/html"
- Jmail.Silent = true
- Jmail.Priority = 3
- Jmail.MailServerUserName = mailname '有效电子邮件帐号
- Jmail.MailServerPassword = mailpass '有效电子邮件密码
- Jmail.From = mailform
- Jmail.FromName = temp_name
- Jmail.Subject = temp_title 'email的标题
- Jmail.AddRecipient ""&abcd&""
- Jmail.Body = m_strHTML
- Jmail.Send(mailsmtp) 'smtp服务器地址
- Set Jmail=nothing
- session("ijob_i")=i+1
- if session("ijob_i")>=bac then
- Response.Write "邮件发送完成!"
- session("ijob_cishu")="" '测试用--清空session
- session("ijob_i")="" '测试用--清空session
- Response.end
- end if
- next
- session("ijob_cishu")=session("ijob_cishu")+1
- response.write "<meta http-equiv=""refresh"" content=""5;url=send.asp?id="&request("id")&""">" '设置系统等待的时间
- 'Response.Write "发送成功!"
- %>