Print Page | Close Window

Sending >10000 emails

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=18043
Printed Date: 29 March 2026 at 10:15am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Sending >10000 emails
Posted By: zMaestro
Subject: Sending >10000 emails
Date Posted: 19 January 2006 at 2:01pm

If I am going to send more than 10,000 emails through CDONTS, and after increasing the server timeout... what are the best techniques used to do so, and how can i send this in mail shots, lets say 1000 every time.

 
I'm currently using this simple code:
 

ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.MapPath("db.mdb")
Set ADO=Server.CreateObject("ADODB.Connection")
ADO.ConnectionString =ConnectionString
ADO.Open
selectSQL="select * from maillist"
set rs=ADO.execute(selectSQL)
do while not rs.eof
set mailObj = Server.CreateObject("CDONTS.NewMail")
mailObj.BodyFormat = 0
mailObj.MailFormat = 0
mailObj.From = Request("From")
mailObj.Subject = Request("Subject")
mailObj.Importance= 0
mailObj.Body = Request("Message")
mailObj.To = rs("email")
mailObj.Send
Response.Write rs("email") &"<BR>"
rs.movenext
loop
rs.close



Replies:
Posted By: Darbs
Date Posted: 19 January 2006 at 2:50pm

use select top 1000 where id>'nnnnn' and call a sub routine.....

or you could use select .....  where emailname like 'a%' and call the sub - then do 'b%','c'%,'d%' etc....  and break it into chunks alphabetically (not forgetting those names that start with a non alphabet chars obviously)..... 


-------------
Who said MSAccess? Not a chance in hell!!
Always available at : http://darbs.hopto.org/


Posted By: WebWiz-Bruce
Date Posted: 19 January 2006 at 6:04pm
Also place the creating of the CDONTS object outside of the loop, that way you use less server resouces.

And don't forget to distroy the object when you finsh.


-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: zMaestro
Date Posted: 23 January 2006 at 4:34pm
i tried to use the CDONTS object outside of the loop but it gave me an error... also it gave me an error when i tried to close the object.Shocked
 
I'll give it another try...


Posted By: Gullanian
Date Posted: 25 January 2006 at 2:16am
I wouldn't use a CDONTS loop, I've tried before it just gets loads of problems and ASP really is designed for doing something like that.

I would recommend using a program or buying one designed to mass mail.


Posted By: dpyers
Date Posted: 26 January 2006 at 1:30am
Check out the postcast server - free download and runs from your pc. IIRC, it can import text and csv

-------------

Lead me not into temptation... I know the short cut, follow me.


Posted By: zMaestro
Date Posted: 27 January 2006 at 6:36pm
I made the scripts in a very nice way...
The CDONTS page sends 100 emails per page, then at the end of the page, there is a JavaScript code

<%If PageNum <> AllPages Then%>
<Script>
function flyto(){
window.location.href('SendMail.asp?&Page=<%=PageNum + 1%>')
}
setTimeout("flyto()",3000)
</Script>
<%End IF%>
 
In this way, if I've 10,000 emails, and I was displaying them 100 per page, so I'll have 100 page.
 
It sends the 1st 100 emails (Page 1), and then goes to page 2, 3, ...etc with a javascript code so i can set the time between every send.
 
 
The way it goes is nice, it shows you how many emails was sent between pages, if any error occured, you can refresh.. and the script will continue working.


Posted By: dpyers
Date Posted: 27 January 2006 at 11:49pm
Elegant Thumbs Up 

-------------

Lead me not into temptation... I know the short cut, follow me.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net