error in my email vbs script
i get an error when i run this..
'Option Explicit
Dim sServer
Dim sLogin
Dim sPwd
Dim oCn
Dim oRs
Dim sNames
Dim oFso
Dim oFileOut
Dim sLineOut
Dim strFrom
Dim strTo
Dim strReply_To
Dim strSubject
Dim strMessage
Dim Filename
Filename = "crystal_reports.pdf"
' Set the database connection information
sServer = "AGP1012284DT"
sLogin = "sa"
sPwd = "tavia"
' Create the ADO Connection and Recordset objects.
Set oCn = CreateObject( "ADODB.Connection" )
Set oRs = CreateObject( "ADODB.Recordset" )
' Create a FileSystemObject.
Set oFso = CreateObject("Scripting.FileSystemObject")
' Set the connection string, open the connection and get rows.
oCn.ConnectionString = "Driver={SQL Server}" & _
";SERVER=" & sServer & _
";UID=" & sLogin & _
";PWD=" & sPwd & _
";DATABASE=edw"
oCn.open
oRs.Open "Select useremail from Users ", oCn
'WScript.echo "test"
'response.end
' Read through all the rows.
While Not oRs.EOF
strFrom = "femig@mtnnigeria.net"
strTo = oRs.Fields("useremail")
strReply_To = "femig@mtnnigeria.net"
strSubject = "VBS Script test + pdf attachment..Again"
strBody = "If you get this + the attachment, then we are on..Next is to get it to loop through a recordset and send emails..."
' Create the CDONTS NewMail object
Set myCDONTSMail = WScript.CreateObject("CDONTS.NewMail")
' Set the Reply-To header of the Newmail object:
myCDONTSMail.Value("Reply-To") = strReply_To
' Send the message and cleanup CDONTS objects
' Attach file
myCDONTSMail.AttachFile FileName
myCDONTSMail.Send strFrom, strTo, strSubject, strMessage
//WScript.echo "Email sent to " & oRs.Fields("useremail")
oRS.MoveNext
Wend
' We're finishedâclose the database objects.
oRs.Close
the error is ..
Microsoft VBScript compilation error: Expected statement..
Can anyone show me where the error is?
thanks
|