Problem with ASP-mailing program

Lorand

New Member
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 a syntax error, since it worked fine before for years.
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?
 

zkiller

Super Moderator
Staff member
what's on line 69 of that file? i'd be more than happy to help you out, but it's kind of hard when i don't really know anything about the code you are running. :)

sorry, i am to lazy to download and install the script...
 

Lorand

New Member
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
		[B]mailObj.Send[/B]
		RS.movenext
	Loop
(The line 69 is in boldface.)
 

zkiller

Super Moderator
Staff member
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.
 

zkiller

Super Moderator
Staff member
you may want to try and contact the maker of the aspemail component about this. who knows, it may be a known problem with the version of the script or component you are using. although persits component are usually pretty good.
 

Lorand

New Member
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)?
 

zkiller

Super Moderator
Staff member
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.
 

Lorand

New Member
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.
 

zkiller

Super Moderator
Staff member
ok, i made some remarks and changes in bold to your code, maybe that will help explain what i tried to explain before.

Code:
[b]	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.[/b]

	Do While Not RS.eof
		mailObj.Host = RSBODY[b].Fields[/b]("SMTP")
		mailObj.From = RSBODY[b].Fields[/b]("From_Email")
		mailObj.FromName = "From_Name" [b]' where is this variable coming from? is it a constant within the code?[/b]
		mailObj.AddAddress RS[b].Fields[/b]("Email")
		mailObj.Subject = Request("Subject") [b]' is this variable being passed via "GET" or "POST" [/b]
		mailObj.Body = Request("Body") [b]' is this variable being passed via "GET" or "POST" [/b]
		If (Request("Format") = "Text") Then
			mailObj.IsHTML = False [b]' is this variable being passed via "GET" or "POST" [/b]
		Else
			mailObj.IsHTML = True [b]' is this variable being passed via "GET" or "POST" [/b]
		End If
		mailObj.Send
		RS.movenext
	Loop

as for trouble shooting and firguring out where the error is coming from, i would simply add a request.write within the loop before the mailobj.send, containing all of the variables being passed to the mailobj to send. it won't look pretty, but it gets the job done and once you figure out wether that's the problem or not, you can simple comment the line out. when troubleshooting you always want to print as much information as you can get on the screen, so you can follow what the script is doing step for step.

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:
 

Lorand

New Member
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
And surprise: there was a bad e-mail address in the list. In fact it was a blank cell in the database. Don't know how it got there and why didn't see that before... :eek:
 

Lorand

New Member
I solved one problem and got another... Some mails were sent several times to some addresses and I have no clue why (already checked: those mail addresses appear only once in the database). Has anything to do with that "On error resume next" command (never happened before modifying the script)?
Also I would like to have a progressbar-like thingy to see what's the script doing. Is there an easy way to do this?
 

Qasim Raza

New Member
problem with ASP send email

I have used the code below as suggest by Lorand on thread

On Error Resume Next
mailObj.Send
If Err.number <> 0 then
response.write("Error at address: '" & RS("Email") & "'<br>")
End If


In my case i have two fields on my page for email address. 'To' email list and 'CC' email list.
For the time being suppose Qasim is the alias of [email protected]
Entries i am trying are
To = [email protected];Qasim Raza;[email protected]

there is no user with Alias 'Qasim Raza' exist any where
by using above code although it doesn't shows any error on page but i actually do not send email to any of the email address mentioned there.

is there any solution for this. Logically speaking user of the application either should be provided message that this particular user name do not exist on server or application should send email to remaining email addresses.

any one have solution for this.
 

zkiller

Super Moderator
Staff member
you can check wether an email address exist or has the prope format in a local database, but not on a another server. for one, you do not have the proper permissions to access a mail server that is not yours. but maybe i misunderstood your question.
 
Top