Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Problems with sending mailinglist


Message #1 by "Daniel Kusters" <dropey@h...> on Sun, 14 Jul 2002 20:39:42
I want to send a mail to all the people in my database. I get a 
error " ...wrong type..."

What's the problem?




<!-- #include file="include\db_open2.asp" -->

<%


	dim strInterest, strFrom, strSubject, strBody, strText, strDate, 
strEmail, strName

	
	strFrom= Request.Form("txtFrom")
	strSubject= Request.Form("txtSubject")
	strBody= Request.Form("txtBody")
	strDate= Date()


dim objcommand2, objrs2 
Set objcommand2 = Server.CreateObject("ADODB.Command")

objcommand2.ActiveConnection = strconnect
objcommand2.commandtext = "select email FROM mailing"
objcommand2.commandtype = adcmdtext


set objrs2 = objcommand2.execute
set objcommand2 = nothing


While not objcommand2.EOF

Set Mailer = Server.CreateObject ("SMTPsvg.Mailer")
Mailer.FromName = email
Mailer.FromAddress = "info@s..."
Mailer.Subject = strSubject
Mailer.ContentType = "text/html"
Mailer.BodyText = strbody
Mailer.RemoteHost = "212.46.120.63"
Mailer.AddRecipient "mailing Strijthagen", objcommand2

if not Mailer.SendMail then
	Response.Write " Mailing Failed to " & objcommand2("email") & " 
Error is: "
	Response.Write Mailer.Response
	Response.Write "</p>"
else
	Response.Write " sent successfully to " & robjcommand2("email")
	Response.Write "</p>"
end if

	Set Mailer=Nothing

	objcommand2.MoveNext
wend 

%>
Message #2 by "Ken Schaefer" <ken@a...> on Mon, 15 Jul 2002 14:05:27 +1000
a) Your data is stored in your recordset (called objrs2) not in objCommand2

b) In future please post the *exact error message* you are receiving

c) When posting code, please indicate which *line* is causing the problem. I
have no idea where your code is having problems because you just posted a
whole lot of stuff without telling us where the problem is occuring

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Daniel Kusters" <dropey@h...>
Subject: [asp_databases] Problems with sending mailinglist


:
: I want to send a mail to all the people in my database. I get a
: error " ...wrong type..."
:
: What's the problem?
:
:
:
:
: <!-- #include file="include\db_open2.asp" -->
:
: <%
:
:
: dim strInterest, strFrom, strSubject, strBody, strText, strDate,
: strEmail, strName
:
:
: strFrom= Request.Form("txtFrom")
: strSubject= Request.Form("txtSubject")
: strBody= Request.Form("txtBody")
: strDate= Date()
:
:
: dim objcommand2, objrs2
: Set objcommand2 = Server.CreateObject("ADODB.Command")
:
: objcommand2.ActiveConnection = strconnect
: objcommand2.commandtext = "select email FROM mailing"
: objcommand2.commandtype = adcmdtext
:
:
: set objrs2 = objcommand2.execute
: set objcommand2 = nothing
:
:
: While not objcommand2.EOF
:
: Set Mailer = Server.CreateObject ("SMTPsvg.Mailer")
: Mailer.FromName = email
: Mailer.FromAddress = "info@s..."
: Mailer.Subject = strSubject
: Mailer.ContentType = "text/html"
: Mailer.BodyText = strbody
: Mailer.RemoteHost = "212.46.120.63"
: Mailer.AddRecipient "mailing Strijthagen", objcommand2
:
: if not Mailer.SendMail then
: Response.Write " Mailing Failed to " & objcommand2("email") & "
: Error is: "
: Response.Write Mailer.Response
: Response.Write "</p>"
: else
: Response.Write " sent successfully to " & robjcommand2("email")
: Response.Write "</p>"
: end if
:
: Set Mailer=Nothing
:
: objcommand2.MoveNext
: wend
:
: %>

Message #3 by "Daniel Kusters" <dropey@h...> on Mon, 15 Jul 2002 11:25:11
Okay...I come back. I have to translate the error message 
(/admin/mailscript.asp, line 28)
Message #4 by "Daniel Kusters" <dropey@h...> on Mon, 15 Jul 2002 12:21:37

I try something today but still i get a error (translated from dutch.. I 
try :) Die Arguments are from wrong type, out off reach or they like 
others. )

ADODB.Command- Fehler '800a0bb9' 

Die Argumente sind vom falschen Typ, liegen außerhalb des 
Gültigkeitsbereiches oder sind miteinander unvereinbar. 

/admin/mailscript.asp, line 27 

I hope you can help me



<%


	dim strFrom, strSubject, strBody, strDate


	
	strFrom= Request.Form("txtFrom")
	strSubject= Request.Form("txtSubject")
	strBody= Request.Form("txtBody")
	strDate= Date()


dim objcommand2, objrs2 
Set objcommand2 = Server.CreateObject("ADODB.Command")

objcommand2.ActiveConnection = strconnect
objcommand2.commandtext = "select email FROM mailing"
objcommand2.commandtype = adcmdtext


set objrs2 = objcommand2.execute
set objcommand2 = nothing


While not objcommand2.EOF

Set Mailer = Server.CreateObject ("SMTPsvg.Mailer")
Mailer.FromName = email
Mailer.FromAddress = "info@s..."
Mailer.Subject = strSubject
Mailer.ContentType = "text/html"
Mailer.BodyText = strbody
Mailer.RemoteHost = "212.46.120.63"
Mailer.AddRecipient "mailing Strijthagen", objrs2("email")

if not Mailer.SendMail then
	Response.Write " Mailing Failed to " & objrs2("email")  

	Response.Write Mailer.Response
	Response.Write "</p>"
else
	Response.Write " sent successfully to " & objrs2("email")
	Response.Write "</p>"
end if

	Set Mailer=Nothing

	objcommand2.MoveNext
wend 

%>
Message #5 by "Kim Iwan Hansen" <kimiwan@k...> on Mon, 15 Jul 2002 13:33:55 +0200
Here you go:
http://www.adopenstatic.com/faq/800a0bb9.asp

-Kim

> -----Original Message-----
> From: Daniel Kusters [mailto:dropey@h...]
> Sent: 15. juli 2002 12:22
> To: ASP Databases
> Subject: [asp_databases] Re: Problems with sending mailinglist
>
>
>
>
> I try something today but still i get a error (translated from dutch.. I
> try :) Die Arguments are from wrong type, out off reach or they like
> others. )
>
> ADODB.Command- Fehler '800a0bb9'
>
> Die Argumente sind vom falschen Typ, liegen außerhalb des
> Gültigkeitsbereiches oder sind miteinander unvereinbar.
>
> /admin/mailscript.asp, line 27
>
> I hope you can help me
>
>
>
> <%
>
>
> 	dim strFrom, strSubject, strBody, strDate
>
>
>
> 	strFrom= Request.Form("txtFrom")
> 	strSubject= Request.Form("txtSubject")
> 	strBody= Request.Form("txtBody")
> 	strDate= Date()
>
>
> dim objcommand2, objrs2
> Set objcommand2 = Server.CreateObject("ADODB.Command")
>
> objcommand2.ActiveConnection = strconnect
> objcommand2.commandtext = "select email FROM mailing"
> objcommand2.commandtype = adcmdtext
>
>
> set objrs2 = objcommand2.execute
> set objcommand2 = nothing
>
>
> While not objcommand2.EOF
>
> Set Mailer = Server.CreateObject ("SMTPsvg.Mailer")
> Mailer.FromName = email
> Mailer.FromAddress = "info@s..."
> Mailer.Subject = strSubject
> Mailer.ContentType = "text/html"
> Mailer.BodyText = strbody
> Mailer.RemoteHost = "212.46.120.63"
> Mailer.AddRecipient "mailing Strijthagen", objrs2("email")
>
> if not Mailer.SendMail then
> 	Response.Write " Mailing Failed to " & objrs2("email")
>
> 	Response.Write Mailer.Response
> 	Response.Write "</p>"
> else
> 	Response.Write " sent successfully to " & objrs2("email")
> 	Response.Write "</p>"
> end if
>
> 	Set Mailer=Nothing
>
> 	objcommand2.MoveNext
> wend
>
> %>

Message #6 by "Ken Schaefer" <ken@a...> on Tue, 16 Jul 2002 13:34:12 +1000
Two problems:

a) www.adopenstatic.com/faq/800a0bb9step2.asp is something you probably need
to look at (undefined ADO constants)

b) objRS2 stores your data, *not* objCommand2 (I wrote this last time). For
example you have the line:

: While not objcommand2.EOF

That isn't going to work. You need:

While Not objRS2.EOF

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Daniel Kusters" <dropey@h...>
Subject: [asp_databases] Re: Problems with sending mailinglist
:
: I try something today but still i get a error (translated from dutch.. I
: try :) Die Arguments are from wrong type, out off reach or they like
: others. )
:
: ADODB.Command- Fehler '800a0bb9'
:
: Die Argumente sind vom falschen Typ, liegen außerhalb des
: Gültigkeitsbereiches oder sind miteinander unvereinbar.
:
: /admin/mailscript.asp, line 27
:
: I hope you can help me
:
:
:
: <%
:
:
: dim strFrom, strSubject, strBody, strDate
:
:
:
: strFrom= Request.Form("txtFrom")
: strSubject= Request.Form("txtSubject")
: strBody= Request.Form("txtBody")
: strDate= Date()
:
:
: dim objcommand2, objrs2
: Set objcommand2 = Server.CreateObject("ADODB.Command")
:
: objcommand2.ActiveConnection = strconnect
: objcommand2.commandtext = "select email FROM mailing"
: objcommand2.commandtype = adcmdtext
:
:
: set objrs2 = objcommand2.execute
: set objcommand2 = nothing
:
:
: While not objcommand2.EOF
:
: Set Mailer = Server.CreateObject ("SMTPsvg.Mailer")
: Mailer.FromName = email
: Mailer.FromAddress = "info@s..."
: Mailer.Subject = strSubject
: Mailer.ContentType = "text/html"
: Mailer.BodyText = strbody
: Mailer.RemoteHost = "212.46.120.63"
: Mailer.AddRecipient "mailing Strijthagen", objrs2("email")
:
: if not Mailer.SendMail then
: Response.Write " Mailing Failed to " & objrs2("email")
:
: Response.Write Mailer.Response
: Response.Write "</p>"
: else
: Response.Write " sent successfully to " & objrs2("email")
: Response.Write "</p>"
: end if
:
: Set Mailer=Nothing
:
: objcommand2.MoveNext
: wend
:
: %>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


  Return to Index