Use ASP + JMAIL to make mail groups

zhaozj2021-02-16  43

During this time, there are too many people who are confused in the mail.

So I took it out of the previous writing of yourself and shared with you. I hope everyone can lift it three.

The key is that if you build a method of self-calling, in the case of a large amount of data, use an array instead of the recordset.

Self-calling can have a lot of applications. In addition to the group of emails, there are such as their own recursive. Many people want to achieve not repeated random numbers to use the following ideas.

Of course, the implementation is not one, but it is diverse, you can also have a better way. I hope to discuss with you!

This page is called email_sendall.asp

<% on Error Resume Next%> <%

If Request ("page") = "" "" page ") end if 'accepts mail content, of course, can also query Comment = Request (" Comment "definition mail array DIM from the database species emailArraysql_email = "SELECT useremail, userregname, userpassword FROM email" Set Recordsetemail = Server.CreateObject ( "ADODB.Recordset") Recordsetemail.ActiveConnection = cnnRecordsetemail.Source = sql_emailRecordsetemail.CursorType = 3Recordsetemail.CursorLocation = 2Recordsetemail.LockType = 1Recordsetemail.Pagesize = 5Recordsetemail .Open () recordsetemail.absolute_count = recordseTeMail.pageCount 'Reads the reads in the database. Emailarray = RecordseTemail.Getrows (5, 0) RecordseTemail.Closeif Err.Number <> 0 Tenjmail.closeSponse.write "Successful mail!" Response.endelse

END IF

set Recordsetemail = nothingif isarray (emailArray) then Repeat1__index = 0 dim U_emailArray U_emailArray = ubound (emailArray, 2) While (Repeat1__index <= U_emailArray) comment1 = replace (comment, "", emailarray (1, Repeat1__index)) comment1 = replace (comment1, "", 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 ("Towho")) Response.write ("Successful Send!
") Set Jmail = Nothing

REPEAT1__DEX = Repeat1__index 1 Wendelse

END IF

Recordset1.close () SET RECORDSET1 = NOTHING 'Build a self-requested itself RESPONSE.REDIRECT "email_sendall.asp? Page =" & (CPAGE 1) & "Subject =" & Request ("Subject") & "fromwho =" & Request ("fromwho") & "comment =" & comment%> Welcome to download http://www.xzss.com/lqy/vml.rar

There is a simple chart class in it

How to use is that the attribute in Test.asp is set to 1 to 4. Time relationship, it also needs to be modified.

Not perfect, welcome criticism to correct!

转载请注明原文地址:https://www.9cbs.com/read-27843.html

New Post(0)