Forum Moderators: open
Here's the deal: I have an ASP form inserting records into a FoxPro Database on windows 2k running IIS. I want the form to send email at the same time that it updates the records - this is for an IT Helpdesk request. I tried inserting the CDONTS.NewMail stuff in the script and it dies - expecting end of statement.
"Error Type:
Microsoft JScript compilation (0x800A03EC)
Expected ';'
/request.asp, line 81, column 4"
I put the code in like this after it writes to the table:
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
Set objMailer = Server.CreateObject("CDONTS.NewMail")
objMailer.From = "IT request"
objMailer.To = "*******@*******.***"
objMailer.Subject = " ******** "
objMailer.BodyFormat = 0
objMailer.MailFormat = 0
objMailer.Importance = 2
objMailer.Body = " **** "
objMailer.Send
Set objMailer = nothing
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
Line 81, column 4 is right in front of the Set objMailer. If there's another way to do this, great! Also, I know that my IT department blocks all outgoing SMTP traffic - It has to go through our mailserver. Is there a way to set that?
Thanks!
I wrote the page in Dreamweaver Ultradev 4 and selected java as the page language in the application server preferences, because I had some other java for timestamping and focusing etc and I wanted to be consistant. I can re-create the dynamic form part in VBScript if need be.
I also need to define my field values that I want in the email, right?
like this?
FieldName = Request.Form("Field_Name")
and then I put that in the CDONTS mail object like this?
objMailer.Body = Email received from &FieldName regarding &Subject
Thanks for your help, people.
objMailer.Body = "Helpdesk request from " &strFrom " & vbCrLf "ReqType: " &strType & vbCrLf "Subject: " &strSubject & vbCrLf "Priority: " &strPriority & vbCrLf "Desired Time: " &strDesTime &vbCrLf "Latest Time: " &strMaxTime & vbCrLf "Details: " &strDetails & vbCrLf "!"
The entire snippet of the mailer portion is
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
strFrom = Request.Form("UserName")
strSubject=Request.Form("subject")
strType=Request.Form("Type")
strPriority=Request.Form("Priority")
strDesTime=Request.Form("DesTime")
strMaxTime=Request.Form("MaxTime")
strDetails=Request.Form("Details")
Set objMailer = Server.CreateObject("CDONTS.NewMail")
objMailer.From = "Global User"
objMailer.To = "noakes@teamglobal.com"
objMailer.Subject = "Helpdesk Request recieved from " &strFrom
objMailer.BodyFormat = 0
objMailer.MailFormat = 0
objMailer.Importance = 2
objMailer.Body = "Helpdesk request from " &strFrom " & vbCrLf "ReqType: " &strType & vbCrLf "Subject: " &strSubject & vbCrLf "Priority: " &strPriority & vbCrLf "Desired Time: " &strDesTime &vbCrLf "Latest Time: " &strMaxTime & vbCrLf "Details: " &strDetails & vbCrLf
objMailer.Send
Set objMailer = nothing
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%
What am I doing wrong? Does anyone have any vb reference-type sites I can refer to? Thanks!
If it is actually appearing on three lines in your code, then you are missing that "&" character AND you need to add in some line continuation (underscore) characters at the end of the first and second line.
Some things to check...
Open IIS Management Console - make sure the Default SMTP Virtual Server is started. Also check in Services for "Simple Mail Transport" service (W2K) and make sure it is running.
If the answer to both of the above is "yes", check the folders for the SMTP Service. These are by default at C:\InetPUB\Mailroot
If files are in Pickup, the service isn't/wasn't running. If files are in badmail or drop, you may have a firewall issue. Open the files in badmail or drop with NOTEPAD and they may contain information on why the emails were undeliverable. If the reason for non-delivery is not clear, post again with some info and we'll go from there.
:-)