zoukankan      html  css  js  c++  java
  • Jmail的使用例程

    <%on error resume next%>
    <!--这里是你们的包含文件-->
    <%
    if request("Page")="" then
    CPage=1
    else
    Cpage=request("Page")
    end if
    '接受邮件内容,当然,也可以从数据库种查询
    comment=request("comment")
    '定义邮件数组
    Dim emailArray
    sql_email="SELECT useremail,userregname,userpassword FROM email"
    Set Recordsetemail=Server.CreateObject("ADODB.Recordset")
    Recordsetemail.ActiveConnection=cnn
    Recordsetemail.Source=sql_email
    Recordsetemail.CursorType=3
    Recordsetemail.CursorLocation=2
    Recordsetemail.LockType=1
    Recordsetemail.Pagesize=5
    Recordsetemail.Open()
    Recordsetemail.AbsolutePage=CPage
    Page_Count=Recordsetemail.PageCount
    '把数据库中的读取到数组中。
    emailArray=Recordsetemail.Getrows(5,0)
    Recordsetemail.close
    if err.number<>0 then
    JMail.Close
    response.write "邮件群发成功!"
    response.end
    else
    end if
    set Recordsetemail=nothing
    if isarray(emailArray) then
    Repeat1__index=0
    dim U_emailArray
    U_emailArray=ubound(emailArray,2)
    While(Repeat1__index<=U_emailArray)
    comment1=replace(comment,"</user>",emailarray(1,Repeat1__index))
    comment1=replace(comment1,"</password>",emailarray(2,Repeat1__index))
    Set JMail=Server.CreateObject("JMail.SMTPMail")
    JMail.ContentType="text/html"
    JMail.Encoding = "base64"
    JMail.Charset="gb2312"
    jmail.Sender=request("fromwho")
    JMail.Subject = request("subject")
    JMail.AddRecipient(emailarray(0,Repeat1__index))
    JMail.Body =comment1
    JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
    JMail.Execute
    JMail.Close
    response.Write(request("ToWho"))
    response.Write(" 成功发送!<BR>")
    Set JMail = Nothing
    Repeat1__index=Repeat1__index+1
    wend
    else
    end if
    Recordset1.Close()
    Set Recordset1 = Nothing
    '构建一个自身请求自身的方法
    response.redirect "email_sendall.asp?page="&(cpage+1)&"subject="&request("subject")&"fromwho="
    &request("fromwho")&"comment="&comment
    %>
  • 相关阅读:
    vue3学习笔记
    学习笔记-Python-爬虫5-Selenium + PhantomJS
    学习笔记-Python-爬虫4-数据提取-正则、XML、XPath、BeautifulSoup4
    学习笔记-Python-爬虫7-Scrapy、分布式爬虫
    学习笔记-Python-爬虫6-验证码
    学习笔记-Python-爬虫3-requests
    学习笔记-Python-爬虫2-SSL、js加密、ajax
    学习笔记-Python-爬虫1-urllib、chardet
    Java多线程同步问题
    jQuery限制文本框只能输入正整数
  • 原文地址:https://www.cnblogs.com/crane/p/327706.html
Copyright © 2011-2022 走看看