PDA

View Full Version : expected end of statement...


Baleric
05-22-2006, 11:07 AM
Hello,
Im Trying to send an email to a user who forgot there password.
Everything worked great till i added the email script in :(

Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/Pages/forgotemail.asp, line 35
iMsg.Send

<%@ Language = "VBScript" %>
<%
Dim cnnLogin1
Dim rstLogin1
Dim strSQL1

strSQL1 = "SELECT * FROM Users " _
& "WHERE email='" & Replace(Request.Form("emailforgot"), "'", "''") & "' "


Set cnnLogin1 = Server.CreateObject("ADODB.Connection")
cnnLogin1.Open("DRIVER={Microsoft Access Driver (*.mdb)};" _
& "DBQ=" & Server.MapPath("../db.mdb"))

Set rstLogin1 = cnnLogin1.Execute(strSQL1)

If Not rstLogin1.EOF Then %>

<%
dim userr
userr = rstLogin1("username")
dim passs
passs = rstLogin1("pword")
Dim iMsg
Set iMsg = CreateObject("CDO.Message")


Set iMsg=CreateObject("CDO.Message")
iMsg.Subject= "Passowrd Request"
iMsg.From= "Passwords@passwords.com"
iMsg.To= Request.Form("emailforgot")
iMsg.htmlBody="Passowrd Request" _
& "<br> Username: <strong>" & Trim(userr) & vbCrLf _
& "<br></strong>Password: <strong>" & Trim(passs) & vbCrLf _
iMsg.Send


response.Redirect("forgot.asp?sent=1" ) %>

<%Else%>

<% response.Redirect("forgot.asp?sent=2" ) %>

<%End If %>


<%
set iMsg=nothing
rstLogin1.Close
Set rstLogin1 = Nothing
cnnLogin1.Close
Set cnnLogin1 = Nothing
%>

line 35 is listed in red,

thanks in advance

cheers.

baleric

Roelf
05-22-2006, 11:16 AM
iMsg.htmlBody="Passowrd Request" _
& "<br> Username: <strong>" & Trim(userr) & vbCrLf _
& "<br></strong>Password: <strong>" & Trim(passs) & vbCrLf _

You need to loose the last underscore in the previous line, otherwise the engine thinks there is more code to execute on that line

Baleric
05-22-2006, 11:22 AM
omg, it really annoys me when you look at code for so long trying to work it out and it is something so simple as an _ :rolleyes: .

thanks again Roelf
you have been a huge help last 2 days

baleric :)