himverma2005
11-14-2007, 06:25 AM
Hi all I want Help on CDOSYS object.
I have made newsletter application in using ASP and MS ACCESS, having data of more than 15000 email id Every thing is working fine but whenever I used to send the mail. The server connection time out method breaks the connect as saying that It has exceeded the maximum time. To tackle it I have used all the ranges between 0-60 but no effects is there. So all the time I have to copy and past 1000 id and then upload .mdb file to FTp then Send. I have to do this process for 15 times to send mail to 15000 mail-id. Can any body help me how to tackle this server connection timeout problem.
My code is here as follow:
<%
Dim conn, rs, mail, subject, message, data_source, sql_select, no
no=0
Set conn = Server.CreateObject("ADODB.Connection")
set rs = server.CreateObject("ADODB.recordset")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("mail.mdb")
session("subject")=request.Form("subject")
session("message")=request.Form("message")
sql_select="select * from users"
rs.Open sql_select, conn
while not rs.eof
set mail=Server.CreateObject("CDO.Message")
mail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusingmethod") = 2
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mail.apparelresources.com"
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 0
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="mymailid"
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="mypassword"
mail.Configuration.Fields.Update
mail.To = rs("email")
mail.Subject = session("subject")
mail.From = "web@apparelresources.com"
mail.HTMLBody = session("message")
mail.Send
response.write ("<BR>Mail sent to: " &rs("id")& " : " &rs("email"))
Set mail = Nothing
no=no+1
rs.movenext
wend
Response.Write("<BR><BR>Emails sent to " & no & " users.")
rs.close
set rs=Nothing
conn.close
set conn=Nothing
%>
I have made newsletter application in using ASP and MS ACCESS, having data of more than 15000 email id Every thing is working fine but whenever I used to send the mail. The server connection time out method breaks the connect as saying that It has exceeded the maximum time. To tackle it I have used all the ranges between 0-60 but no effects is there. So all the time I have to copy and past 1000 id and then upload .mdb file to FTp then Send. I have to do this process for 15 times to send mail to 15000 mail-id. Can any body help me how to tackle this server connection timeout problem.
My code is here as follow:
<%
Dim conn, rs, mail, subject, message, data_source, sql_select, no
no=0
Set conn = Server.CreateObject("ADODB.Connection")
set rs = server.CreateObject("ADODB.recordset")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("mail.mdb")
session("subject")=request.Form("subject")
session("message")=request.Form("message")
sql_select="select * from users"
rs.Open sql_select, conn
while not rs.eof
set mail=Server.CreateObject("CDO.Message")
mail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusingmethod") = 2
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mail.apparelresources.com"
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 0
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="mymailid"
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="mypassword"
mail.Configuration.Fields.Update
mail.To = rs("email")
mail.Subject = session("subject")
mail.From = "web@apparelresources.com"
mail.HTMLBody = session("message")
mail.Send
response.write ("<BR>Mail sent to: " &rs("id")& " : " &rs("email"))
Set mail = Nothing
no=no+1
rs.movenext
wend
Response.Write("<BR><BR>Emails sent to " & no & " users.")
rs.close
set rs=Nothing
conn.close
set conn=Nothing
%>