Link to home
Start Free TrialLog in
Avatar of kajamy
kajamy

asked on

multiple lines in text body

I am trying to send a message using CDO, I receive the password but not the alias,
here is my code :-

Set oMail = Server.CreateObject("CDO.Message")
Set iConf = Server.CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = 1
iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\Inetpub\mailroot\Pickup"
iConf.Fields.Update
Set oMail.Configuration = iConf
oMail.To             = "Email"
oMail.From       = "me@here.com"
oMail.Subject       = "Welcome to our member section!"
oMail.TextBody       = "Your Password is: " & PasswordTemp  & vbCrLf
oMail.TextBody           = "Your Alias is: " & user  & vbCrLf

oMail.Send
Set iConf = Nothing
Set Flds = Nothing

appreciate any help
Avatar of Barry62
Barry62
Flag of United States of America image

Well, if you are getting the password back, then CDO is working fine.  I think you need to show more of your script.  Where do you populate the 'user' variable?

Barry62
Avatar of kajamy
kajamy

ASKER

This is my script :-

useraction = request("action")
select case useraction
case "login"
'generate the function
PasswordTemp = rndit()
'collect data from form
Alias = request.form("Alias")
Email = request.form("Email")
Age = request.form("Age")
'response.write Alias & Email & Age & rndit'***debug
'database objects
Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.Recordset")
'sql query
sql = "select Password from users where Password='"&PasswordTemp&"' or Alias='"& Alias & "' or Age='"& Age & "'"
Conn.Open dsn
rs.open sql,conn
if rs.eof and rs.bof then
sql1 = "insert into users (Alias,Password,Age,Email) values('"& Alias & "',"& PasswordTemp & ",'"& Age & "', '"& Email & "')"
conn.execute(sql1)
response.write "<script>alert('you registered succefully');location.href='index.asp';</script>"


       
Set oMail = Server.CreateObject("CDO.Message")
Set iConf = Server.CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = 1
iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\Inetpub\mailroot\Pickup"
iConf.Fields.Update
Set oMail.Configuration = iConf
oMail.To             = "Email"
oMail.From             = "me@here.com"
oMail.Subject       = "Welcome to our member section!"
oMail.TextBody       = "Your Alias is: " & Alias  & vbCrLf
oMail.TextBody  = "Your Password is: " & PasswordTemp  & vbCrLf

oMail.Send
Set iConf = Nothing
Set Flds = Nothing

            else
response.write "<script>alert('Alias already exists');</script>"
                  
            end if
            
rs.close
set rs = nothing
conn.close
set conn = nothing

end select
%>      

ASKER CERTIFIED SOLUTION
Avatar of Barry62
Barry62
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kajamy

ASKER

Cool tried that the message now reads :-

Your Alias is:
Your Password is: 500118

I  removed the <br> as they are not necessary.

any idea why the password doesn't show up?
Avatar of kajamy

ASKER

Ok tried it in reverse and got :-

Your Password is: 953701
Your Alias is:

so it's my variables that are wrong