|
|
#1 (permalink) |
|
New Member
![]() Join Date: Aug 2004
Posts: 12
|
I have a curious error when running an ASP script that sends e-mails to our subscribers (the script is from Ocean12). There are almost 15.000 subscribers and the script worked fine until something was upgraded on the server. Now the script runs very slow (about 10x slower than before) and at a certain moment (after sending about 1/3 of mails) it gives this error and stops:
Code:
Persits.MailSender.4 error '800a0006' 501 Syntax error /ocean_mail/send2.asp, line 69 It can't be caused by a bad mail-address either, since I managed to send out our newsletter without any problem by splitting up the database in 10 smaller database containing 1.500 addresses each. The webmaster said that there's nothing wrong with the server's software... Then what the hell could cause this error? |
|
|
|
|
|
#3 (permalink) |
|
New Member
![]() Join Date: Aug 2004
Posts: 12
|
Sorry, I forgot to post that part of the script. Here it is:
Code:
Do While Not RS.eof
Set mailObj = Server.CreateObject("Persits.MailSender")
mailObj.Host = RSBODY("SMTP")
mailObj.From = RSBODY("From_Email")
mailObj.FromName = "From_Name"
mailObj.AddAddress RS("Email")
mailObj.Subject = Request("Subject")
mailObj.Body = Request("Body")
If (Request("Format") = "Text") Then
mailObj.IsHTML = False
Else
mailObj.IsHTML = True
End If
mailObj.Send
RS.movenext
Loop
|
|
|
|
|
|
#4 (permalink) |
|
Super Noob
![]() |
well, to be honest, i have no clue where you are getting the syntax error from since it doesn't do it with smaller databases. however, i did download the script and took a look at it and although it is quite feature rich, i found that they got a bit sloopy with the code in some instances. i doubt that that is the problem, but you never know. for instance, it should not be RSBODY("SMTP") as it is missing a part. it should look more like this... RSBODY.Fields("SMTP"). but like i said, i doubt that that's where the problem is coming from though. what are you using for a database? if you are using a access database, i recommend upgrading to either MySQL or MS SQL if at all possible, since your database is getting rather large. this would help a lot with the speed factor and would be much more stable as well.
|
|
|
|
|
|
#6 (permalink) |
|
New Member
![]() Join Date: Aug 2004
Posts: 12
|
I use an Access database, but that wouldn't be a problem, since it worked well a couple of months ago. Then the sending of 15.000 mails was completed in approx. 15 minutes. Now it spends 15-20 minutes sending only 1.500 mails...
The script timeout is set to 1.000.000 seconds, so the error can't be caused by timeout either. The RSBODY.Fields("SMTP") is the value of the "SMTP" field from the database, it's the server's SMTP server address. If it would be wrong or missing, not a single mail would be sent from the server. So I think it's something wrong on the server. What program could interfere with this script? I know that if a mail address is not accepted a solution would be inserting the line "On error resume next" before that "mailObj.Send". That would prevent the error message, but how can I be certain that only that particular mail wouldn't be sent? Is there an easy way to get some feedback from that script (e.g. a list of all skipped addresses)? |
|
|
|
|
|
#7 (permalink) |
|
Super Noob
![]() |
i think you missread my first message. anyways...
access isn't a good choice for large databases. they tend to crap out or get really slow as they grow. they are really just meant for smaller office applications. it's not a server side error. like the error says, it's a syntax error, meaning that the contents of the varibles passed thru the script are either wrong, or contain something that the script has a problem processing. the best way to trouble shot is to have the contents of the variables printed on screen. that will tell you where the script stops and came up with the error message and will help you determin where the syntax error is coming from precisely. |
|
|
|
|
|
#8 (permalink) |
|
New Member
![]() Join Date: Aug 2004
Posts: 12
|
I'll go with "On error resume next" before the "mailObj.Send" command. So the script will no longer stop on errors.
But how can i output the parameters that would cause the error? Every time the "mailObj.Send" command is not executed I want his parameters listed. |
|
|
|
|
|
#9 (permalink) |
|
Super Noob
![]() |
ok, i made some remarks and changes in bold to your code, maybe that will help explain what i tried to explain before.
Code:
Set mailObj = Server.CreateObject("Persits.MailSender")
' you should create the object before the loop. no need to do it over and over
' again. the object only needs to created once.
Do While Not RS.eof
mailObj.Host = RSBODY.Fields("SMTP")
mailObj.From = RSBODY.Fields("From_Email")
mailObj.FromName = "From_Name" ' where is this variable coming from? is it a constant within the code?
mailObj.AddAddress RS.Fields("Email")
mailObj.Subject = Request("Subject") ' is this variable being passed via "GET" or "POST"
mailObj.Body = Request("Body") ' is this variable being passed via "GET" or "POST"
If (Request("Format") = "Text") Then
mailObj.IsHTML = False ' is this variable being passed via "GET" or "POST"
Else
mailObj.IsHTML = True ' is this variable being passed via "GET" or "POST"
End If
mailObj.Send
RS.movenext
Loop
i don't know much about the mail object that you are using, but you may want to check persists web site. i built a mail script a while back using smartaspmail (i believe that's what it is called) a while back. it had a function built into it to where when a error accured it would give you an error code with short description and you could also tell it what to do in case of an error, which in your case would be to display the contents of the variables being passed. i know i haven't been of much help to you, but as both you and i have said, i doubt it's a problem with the script. :shrug: |
|
|
|
|
|
#10 (permalink) |
|
New Member
![]() Join Date: Aug 2004
Posts: 12
|
I solved the problem!
Here's the part of the code that was rewritten: Code:
On Error Resume Next
mailObj.Send
If Err.number <> 0 then
response.write("Error at address: '" & RS("Email") & "'<br>")
End If
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|