Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: cant send recordset in email


Message #1 by "John Sen Yong" <yjohns@t...> on Wed, 27 Jun 2001 21:57:30 +0800
please help...

i have a page which compare the username with database

once matched , i will send email to him..

the problem is that

 i can put the recordset inside the email together....



my code is stg like this:



Set passRS =3D Server.CreateObject( "ADODB.Recordset" )

sqlString =3D "SELECT Customer_ID FROM Customer " &_ "WHERE 

CUsername=3D'" & Request("username") & "' "

passRS.ActiveConnection=3DobjConn

passRS.Open (sqlString)

IF NOT passRS.EOF then

SET NewMailObj=3DServer.CreateObject("CDONTS.NewMail")

 NewMailObj.From=3D "one8@t... " NewMailObj.To=3D 

passRS("C_Email")

 NewMailObj.Subject=3D "Password Information!" sMailBody=3D"Dear "& 

passRS("CUsername") & ","& vbNewLine & vbNewLine

sMailBody=3DsMailBody & "Here is your password:"

sMailBody=3DsMailBody & passRS("CPassword")& vbNewLine

sMailBody=3DsMailBody & "With regards" & " ," & vbNewLine

sMailBody=3DsMailBody & "support18@t..."

NewMailObj.Body=3DsMailBody NewMailObj.Send

SET NewMailObj=3DNothing



as you can see..i send the password using the recordset 

passRS("Cpassword")..

but it just doesnt work out although i put response.write infront

please help...urgent..



Message #2 by Pappas Nikos <pappas@c...> on Thu, 28 Jun 2001 03:51:50 +0300
try this

Set passRS = Server.CreateObject( "ADODB.Recordset" ) 

sqlString = "SELECT Customer_ID FROM Customer " &_ "WHERE  

CUsername='" & Request("username") & "' " 

passRS.ActiveConnection=objConn 

passRS.Open (sqlString) 

IF NOT passRS.EOF then 



dim tomail

dim pass

dim user

tomail=passRS("C_Email")

pass = passRS("CPassword")

user  = passRS("CUsername")



SET NewMailObj=Server.CreateObject("CDONTS.NewMail") 

NewMailObj.From= "one8@t... " 

NewMailObj.To = "" & tomail 

NewMailObj.Subject= "Password Information!" 

sMailBody="Dear   " &  ""& user,"& vbNewLine 

sMailBody=sMailBody & "Here is your password:" 

sMailBody=sMailBody & "" & pass & vbNewLine 

sMailBody=sMailBody & "With regards" & " ," & vbNewLine 

sMailBody=sMailBody & "support18@t..."

NewMailObj.Body=sMailBody NewMailObj.Send 

SET NewMailObj=Nothing



Notice the double quotes "" before the strings

I hope it will work

PS remoove the =20 and 3D stuff 

not mine

Cheers

Nikos



At 09:57 μμ 27/6/2001 +0800, you wrote:

>please help...

>i have a page which compare the username with database

>once matched , i will send email to him..

>the problem is that

> i can put the recordset inside the email together....

>

>my code is stg like this:

>

>Set passRS =3D Server.CreateObject( "ADODB.Recordset" )

>sqlString =3D "SELECT Customer_ID FROM Customer " &_ "WHERE 

>CUsername=3D'" & Request("username") & "' "

>passRS.ActiveConnection=3DobjConn

>passRS.Open (sqlString)

>IF NOT passRS.EOF then

>SET NewMailObj=3DServer.CreateObject("CDONTS.NewMail")

> NewMailObj.From=3D "one8@t... " NewMailObj.To=3D 

>passRS("C_Email")

> NewMailObj.Subject=3D "Password Information!" sMailBody=3D"Dear "& 

>passRS("CUsername") & ","& vbNewLine & vbNewLine

>sMailBody=3DsMailBody & "Here is your password:"

>sMailBody=3DsMailBody & passRS("CPassword")& vbNewLine

>sMailBody=3DsMailBody & "With regards" & " ," & vbNewLine

>sMailBody=3DsMailBody & "support18@t..."

>NewMailObj.Body=3DsMailBody NewMailObj.Send

>SET NewMailObj=3DNothing

>

>as you can see..i send the password using the recordset 

>passRS("Cpassword")..

>but it just doesnt work out although i put response.write infront

>please help...urgent..




  Return to Index