表单提交问题

时间:2013-05-28 22:22:16

标签: asp-classic vbscript html-form

我正在尝试使用.Asp提交我的EnquiryForm,但我一直收到服务器错误...

希望将捕获的表单详细信息发送到我的电子邮件地址,并与客户确认详细信息。

任何想法为什么它不起作用....

更新代码:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"   
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<%

            'send by connecting to port 25 of the SMTP server'
            Dim iMsg
            Dim iConf
            Dim Flds
            Dim strBody
            Dim strSmartHost

            Const cdoSendUsingPort = 2
                StrSmartHost = "smtp.glimmer-nights.co.uk"

                set iMsg = CreateObject("CDO.Message")
                set iConf = CreateObject("CDO.Configuration")
                set Flds = iConf.Fields

                'Set the CDOSYS configuration fields to use port 25 on the SMTP server'
                With Flds
                    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
                    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmartHost
                    .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
                    .Update
                End With

                'Build Message body'
                strBody = "Fullname: " & Request.form("firstname") & Request.form("Surname") & vbcrlf
                strBody = strBody & "Address: " & Request.form("Address") & vbcrlf
                strBody = strBody & "Postcode: " & Request.form("postcode") & vbcrlf
                strBody = strBody & "Contact No: " & Request.form("tel") & vbcrlf
                strBody = strBody & "Email: " & Request.form("email") & vbcrlf
                strBody = strBody & "How did you hear about us: " & Request.form("where") & vbcrlf
                strBody = strBody & "Function Date: " & Request.form("fday") & Request.form("fmonth") & Request.form("fyear") & vbcrlf
                strBody = strBody & "Venue Name: " & Request.form("vname") & vbcrlf
                strBody = strBody & "Venue Address: " & Request.form("vaddress") & vbcrlf
                strBody = strBody & "Venue Postcode: " & Request.form("vpostcode") & vbcrlf
                strBody = strBody & "Function Type: " & Request.form("ftype") & vbcrlf
                strBody = strBody & "No. Attending: " & Request.form("noattend") & vbcrlf
                strBody = strBody & "Arrive At: " & Request.form("arrive") & vbcrlf
                strBody = strBody & "Guest Arrival: " & Request.form("garrival") & vbcrlf
                strBody = strBody & "Function End: " & Request.form("fend") & vbcrlf
                strBody = strBody & "Additional Information: " & Request.form("additionalInfoTextarea")

                'Apply the settings to the message'
                With iMsg
                Set .Configuration = iConf
                    .To = "info@glimmer-nights.co.uk"
                    .From = "info@glimmer-nights.co.uk"
                    .Subject = "Online Enquiry"
                    .TextBody = strBody
                    .Send
                End With

                Response.Write("<h1>Booking Enquiry Sent!</h1><p>Thank you for submitting your online booking enquiry for DJ's in Telford or Dj's in Shropshire.  We will contact you shortly.<p>")

                'SEND EMAIL TO CUSTOMER'
                'Build Message body'

                strBody = "Hi " & Request.form("firstname") & " " & Request.form("surname") & "," & vbcrlf & vbcrlf

                strBody = strBody & "We have your contact details as follows: " & vbcrlf & vbcrlf
                strBody = strBody & "Fullname: " & Request.form("firstname") & Request.form("Surname") & vbcrlf
                strBody = strBody & "Contact No: " & Request.form("tel") & vbcrlf
                strBody = strBody & "Email: " & Request.form("email") & vbcrlf
                strBody = strBody & "Address: " & Request.form("Address") & vbcrlf
                strBody = strBody & "Postcode: " & Request.form("postcode") & vbcrlf
                strBody = strBody & "Your function details are as follows: " & vbcrlf & vbcrlf
                strBody = strBody & "Function Date: " & Request.form("fday") & Request.form("fmonth") & Request.form("fyear") & vbcrlf
                strBody = strBody & "Venue Name: " & Request.form("vname") & vbcrlf
                strBody = strBody & "Venue Address: " & Request.form("vaddress") & vbcrlf
                strBody = strBody & "Venue Postcode: " & Request.form("vpostcode") & vbcrlf
                strBody = strBody & "Function Type: " & Request.form("ftype") & vbcrlf
                strBody = strBody & "No. Attending: " & Request.form("noattend") & vbcrlf
                strBody = strBody & "Guest Arrival: " & Request.form("garrival") & vbcrlf
                strBody = strBody & "Function End: " & Request.form("fend") & vbcrlf
                strBody = strBody & "Additional Information: " & Request.form("additionalInfoTextarea") & vbcrlf
                strBody = strBody & "Your quotation will be based on the information provided above." & vbcrlf & vbcrlf
                strBody = strBody & "Thank you for your online booking enquiry. We will be in contact with you shortly to confirm availability & prices." & vbcrlf & vbcrlf
                strBody = strBody & "We look forward to speaking to you soon." & vbcrlf & vbcrlf
                strBody = strBody & "DJ Glimmer" & vbcrlf
                strBody = strBody & "Glimmer Nights Entertainment" & vbcrlf
                strBody = strBody & "T: 01952 247207" & vbcrlf
                strBody = strBody & "M: 07772 471449" & vbcrlf & vbcrlf

                'Apply the settings to the message'
                With iMsg
                Set .Configuration = iConf
                    .To = Request.form("email")
                    .From = "info@glimmer-nights.co.uk"
                    .Subject = "Your Entertainment Booking Enquiry"
                    .TextBody = strBody
                    .Send
                End With

                Then 

                'Enquiry Sent - redirect to Home page'
                Response.Redirect("http://www.glimmer-nights.co.uk/index.html")

                End

                'Cleanup of variables'
                Set iMsg = Nothing
                Set iConf = Nothing
                Set Flds = Nothing

%>

</body>
</html>

1 个答案:

答案 0 :(得分:0)

您有语法错误。有这段代码:

Then 

'Enquiry Sent - redirect to Home page'
Response.Redirect("http://www.glimmer-nights.co.uk/index.html")

End

这是错误的,可能是由编写代码的程序员给我的错误。它应该只是:

'Enquiry Sent - redirect to Home page'
Response.Redirect("http://www.glimmer-nights.co.uk/index.html")

如果仍然没有运气,请发布完整的错误消息以及导致它的行。