Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting ASPMAIL to CDONTS Problem... 1

Status
Not open for further replies.

Anthony904

IS-IT--Management
Jul 15, 2004
153
US
I was given the task of moving other developers webpages to a new server..

I found a problem with the mailing code they were using.. The old server
supported ASPMAIL.. the new server supports CDONTS. I am stuck here having to
convert each page. So far I am able to convert all pages fine.. I have run into
a problem..

My problem is I am getting an error:

Code:
Microsoft VBScript runtime error '800a01b6' 

Object doesn't support this property or method: 'Mailer.to'

The error points to the line:
Mailer.To rst("name"), rst("email")

in this section of the code:

Code:
set rst = dbcon.execute("SELECT * from DISTRIBUTION WHERE form = 'CSA' AND type = 'TO'")
while not rst.eof
	if len(rst("email")) > 0 then
		'Mailer.To rst("name"), rst("email")
		Mailer.To = "myemail@yahoo.com"
	end if
	rst.movenext
wend
rst.close

The section above is trying to mail to a distribution list.

For Testing purposes.. I added line:
Mailer.To = "myemail@yahoo.com"

to the code and it e-mails fine.

- I say again this isn't my code, I'm just here to move the pages over and make them work.
( I could go to the developer but he's gone )

If you need to see more code.. let me know..

Thanks for your help..




 
Well in your code, you added an "=" sign. First...try throwing that in their code to see if it does the trick. Second, if it doesn't, maybe force quotes around the rst variables.

Let us know how it goes.
 
Thanks for the response..

Ok I tried..

adding the "=" sign

Mailer.To = rst("name"), rst("email")

Got an error
Code:
Microsoft VBScript compilation error '800a0401' 

Expected end of statement

Next,

I tried

Code:
Mailer.To "rst("name")", "rst("email")"

Code:
Error:
Microsoft VBScript compilation error '800a0401' 

Expected end of statement

I also tried..

Mailer.To "rst("name"), rst("email")"

and got the same error as above..

any other suggestions?

Thanks!



 
Well it's nice to see somebody try a few variations of the listed suggestion. Thanks for that and let's see if we can help nail this:

Code:
Mailer.To = "" & rst("email") & ""

Try just using the email address for now. Also, if that doesn't work, try the different variations of it that you tried before, except only with the email...not the name as well. See if we can get it working and then add the sender name later.
 
Ok.. I think we've got it.. but I'm am not for sure that it went through..

From the code you suggested above.. I tried and it passed...

So I added..

Code:
Mailer.To = "" & rst("name") & rst("email") &""

and that seems to go through with no errors..

Now I am not on this distribution list.. and I am not sure if this is sending to the distribution list..

soo I added another Mailer.To line:

Code:
Mailer.To = "" & rst("name") & rst("email") &""
Mailer.To = "MyEmail@yahoo.com"

and this did send me an e-mail..

Is there another way of testing if this actually sent to the distribution list?

thanks for all your help!
 
Maybe add yourself to the distribution list? Or create a dummy list that includes some email addresses that you can check. Also, you may need to add the comma between the rst("name") and rst("email"). I haven't tested but I'd bet that the comma is necessary to separate the sender's name from the sender's address.
 
Ok.. I tried a couple ways..

Code:
Mailer.To = "" & rst("name"), & rst("email") &""

and this returned an error

Expected end of statement

This one went through.. but will this work?

Code:
Mailer.To = "" & rst("name") & "," & rst("email") &""

Thanks!





 
The second one you used should work just fine. Can you create a dummy or test distribution list that only includes you and maybe another address you have to see how it works?

There is probably a cleaner way to write it but I'm drawing a major blank right now.

Try to populate a list of testing addresses and see what kind of results you get.
 
I created a test distribution table.. and it work.. I did however have a problem with the rst("name") part of it.

Code:
Mailer.To = "" & rst("name") & "," & rst("email") &""

When I sent the form with the code above, I got in return in my e-mail a delivery failure notice.. When i looked at it.. it was trying to send the person's name on the distribution list plus their e-mails together.

It would however deliever the mail.

I remembered that ASPMAIL uses your name and your e-mail address for the recipient part of the code. .To =

Mailer.AddRecipient = "Your Name", "Your@EmailAddress.com"

And that CDONTS only uses E-Mail Address

Mailer.To = "Your@EmailAddress.com"

So I removed "name" from the code

Code:
Mailer.To = "" & rst("email") &""

and everything works out perfectly...

Thank you very much for your time.. !

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top