send_old.asp
上传用户:lwb168
上传日期:2021-10-31
资源大小:722k
文件大小:3k
源码类别:

Email服务器

开发平台:

ASP/ASPX

  1. <!--#include file="conn.asp"-->
  2. <%
  3.   sql="select email,email_pass,email_pop,name,title from mail where id="&request("id")
  4.   rs.open sql,conn,1,2
  5. temp_email=rs("email")
  6. temp_email_pass=rs("email_pass")
  7. temp_email_pop=rs("email_pop")
  8. temp_name=rs("name")
  9. temp_title=rs("title")
  10. rs.close
  11. 'IJOB邮件群发系统 作者:IJOB  修改:阿标
  12. Server.ScriptTimeout=10000
  13. 'session("ijob_cishu")=""
  14. 'session("ijob_i")=""
  15. if session("ijob_cishu")="" then
  16. session("ijob_cishu")=0
  17. end if
  18. if session("ijob_i")="" then
  19. session("ijob_i")=1
  20. end if
  21. function FSOlinedit(filename,lineNum)
  22. if linenum < 1 then exit function
  23. dim fso,f,temparray,tempcnt
  24. set fso = server.CreateObject("scripting.filesystemobject")
  25. if not fso.fileExists(server.mappath(filename)) then exit function
  26. set f = fso.opentextfile(server.mappath(filename),1)
  27. if not f.AtEndofStream then
  28. tempcnt = f.readall
  29. f.close
  30. set f = nothing
  31. temparray = split(tempcnt,chr(13)&chr(10))
  32. if lineNum>ubound(temparray)+1 then
  33. exit function
  34. else
  35. FSOlinedit = temparray(lineNum-1)
  36. end if
  37. end if
  38. end function
  39. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  40. ''设置邮件参数
  41. filename="dizhi.txt"  '邮件地址列表
  42. dim mailname,mailpass,mailform,mailsmtp
  43. mailname=temp_email '有效电子邮件帐号,有的邮件服务器需要的是ekeer2001@sohu.com等这种格式的帐号,出错后请调整这些!
  44. mailpass=temp_email_pass '有效电子邮件密码
  45. mailform=temp_email '发信邮件地址,必须和SMTP相对应起来
  46. mailsmtp=temp_email_pop 'smtp服务器
  47. dim m_strHTML,Jmail,m_fso,m_tf,filepath,jingyanshuoming,photo,bj1,bj2
  48. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  49. ''计算文件行数
  50. Set m_fso = Server.CreateObject("SCRIPTING.FILESYSTEMOBJECT")
  51. filepath=server.mappath(filename)
  52. Set m_tf = m_fso.OpenTextFile(filepath, 1)
  53. m_strHTML = m_tf.ReadAll
  54. bac = m_tf.line
  55. Set m_tf = Nothing
  56. Set m_fso = Nothing
  57. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  58. ''读取文件并发送邮件
  59. Set m_fso = Server.CreateObject("SCRIPTING.FILESYSTEMOBJECT")
  60. filepath=server.mappath("1.htm")
  61. Set m_tf = m_fso.OpenTextFile(filepath, 1)
  62. m_strHTML = m_tf.ReadAll
  63. Set m_tf = Nothing
  64. Set m_fso = Nothing
  65. cishu=bac/20
  66. 'i=session("ijob_i")
  67. i=session("ijob_cishu")*20
  68. Response.Write "执行第<font color=#ff0000>"&session("ijob_cishu")&"</font>次<br>"
  69. Response.Write "邮件总数:"&bac&"<br>"
  70. Response.Write "需要执行:"&cishu&"<br>"
  71. Response.Write ""&d&"<br>"
  72. for i=i to i+19
  73. Set Jmail=server.createobject("Jmail.Message")
  74. abcd=FSOlinedit(filename,i)
  75. Response.Write "<font color=#ff0000>"&i&"</font>+"&abcd&"<br>"
  76. Jmail.Charset = "gb2312"
  77. JMail.ContentType = "text/html"
  78. Jmail.Silent = true
  79. Jmail.Priority = 3
  80. Jmail.MailServerUserName = mailname  '有效电子邮件帐号
  81. Jmail.MailServerPassword = mailpass  '有效电子邮件密码
  82. Jmail.From = mailform
  83. Jmail.FromName = temp_name
  84. Jmail.Subject = temp_title 'email的标题                
  85. Jmail.AddRecipient  ""&abcd&"" 
  86. Jmail.Body = m_strHTML
  87. Jmail.Send(mailsmtp)  'smtp服务器地址
  88. Set Jmail=nothing
  89. session("ijob_i")=i+1
  90. if session("ijob_i")>=bac then
  91. Response.Write "邮件发送完成!"
  92. session("ijob_cishu")="" '测试用--清空session
  93. session("ijob_i")=""     '测试用--清空session
  94. Response.end
  95. end if
  96. next
  97. session("ijob_cishu")=session("ijob_cishu")+1
  98. response.write "<meta http-equiv=""refresh"" content=""5;url=send.asp?id="&request("id")&""">" '设置系统等待的时间
  99. 'Response.Write "发送成功!"
  100. %>