Use Asp+jmail for mass mailing

Source: Internet
Author: User
This period of time to see too many people confused with the mass mailing.
So I used to write a dongdong to share with you. I hope you can extrapolate.
The key is to build a method of its own invocation, and in the case of large amounts of data, use an array instead of a recordset.
Its own calls can have a lot of applications. In addition to the bulk of the mail, there are, for example, their own recursion. Many people want to achieve a repeat random number can use the following ideas.
Of course, the implementation is not always one, but diverse, you can also have a better way. Hope to be able to learn from everyone!
This page is called email_sendall.asp
<%on Error Resume Next%>
<!--here are your included files-->
<%
If Request ("Page") = "" Then
Cpage=1
Else
Cpage=request ("Page")
End If
' Accept the message content, of course, you can also query from the database type
Comment=request ("comment")
' Define an array of messages
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
' Read to the array in the database.
Emailarray=recordsetemail.getrows (5,0)
Recordsetemail.close
If Err.number<>0 Then
Jmail.close
Response.Write "Mail mass success!" "
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"
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.