Asp classic 联系人表单上的典型ASP内部错误

Asp classic 联系人表单上的典型ASP内部错误,asp-classic,Asp Classic,我的表单在提交时会显示一个内部错误页面。我已经定义了所有字段,并通过了我的SMTP信息。看起来好像一切都会好起来。但事实并非如此 如有任何建议,我们将不胜感激 <% 'Declaring Variables Dim smtpserver,youremail,yourpassword,ContactUs_Name,ContactUs_Email Dim ContactUs_Subject,ContactUs_Body,Action,IsError ' Edit these 3 values

我的表单在提交时会显示一个内部错误页面。我已经定义了所有字段,并通过了我的SMTP信息。看起来好像一切都会好起来。但事实并非如此

如有任何建议,我们将不胜感激

<%
'Declaring Variables
Dim smtpserver,youremail,yourpassword,ContactUs_Name,ContactUs_Email
Dim ContactUs_Subject,ContactUs_Body,Action,IsError

' Edit these 3 values accordingly
smtpserver = "mysmtperserver"
youremail = "myemail"
yourpassword = "mypassword"

' Grabbing variables from the form post
ContactUs_Name = Server.HTMLEncode(Request("ContactUs_Name"))
ContactUs_Email = Server.HTMLEncode(Request("ContactUs_Email"))
ContactUs_Subject = Server.HTMLEncode(Request("ContactUs_Subject"))
ContactUs_Body = Server.HTMLEncode(Request("ContactUs_Body"))
ContactUs_Captcha = Request("recaptcha_response_field")
Action = Request("Action")

' Used to check that the email entered is in a valid format
Function IsValidEmail(Email)
    Dim ValidFlag,BadFlag,atCount,atLoop,SpecialFlag,UserName,DomainName,atChr,tAry1
    ValidFlag = False
        If (Email <> "") And (InStr(1, Email, "@") > 0) And (InStr(1, Email, ".") > 0) Then
            atCount = 0
            SpecialFlag = False
            For atLoop = 1 To Len(Email)
            atChr = Mid(Email, atLoop, 1)
                If atChr = "@" Then atCount = atCount + 1
                If (atChr >= Chr(32)) And (atChr <= Chr(44)) Then SpecialFlag = True
                If (atChr = Chr(47)) Or (atChr = Chr(96)) Or (atChr >= Chr(123)) Then SpecialFlag = True
                If (atChr >= Chr(58)) And (atChr <= Chr(63)) Then SpecialFlag = True
                If (atChr >= Chr(91)) And (atChr <= Chr(94)) Then SpecialFlag = True
            Next
            If (atCount = 1) And (SpecialFlag = False) Then
                BadFlag = False
                tAry1 = Split(Email, "@")
                UserName = tAry1(0)
                DomainName = tAry1(1)
            If (UserName = "") Or (DomainName = "") Then BadFlag = True
            If Mid(DomainName, 1, 1) = "." then BadFlag = True
            If Mid(DomainName, Len(DomainName), 1) = "." then BadFlag = True
                ValidFlag = True
            End If
        End If
        If BadFlag = True Then ValidFlag = False
        IsValidEmail = ValidFlag
End Function
%>

<%
If Action = "SendEmail" Then

    ' Here we quickly check/validate the information entered
    ' These checks could easily be improved to look for more things
    If IsValidEmail(ContactUs_Email) = "False" Then
        IsError = "Yes"
        Response.Write("<font color=""red"">Please enter valid Email address.</font><br>")
    End If

    If ContactUs_Name = "" Then
        IsError = "Yes"
        Response.Write("<font color=""red"">Please enter your Name.</font><br>")
    End If

    If ContactUs_Subject = "" Then
    IsError = "Yes"
        Response.Write("<font color=""red"">Please enter a Subject.</font><br>")
    End If

    If ContactUs_Body = "" Then
        IsError = "Yes"
        Response.Write("<font color=""red"">Please include Message.</font><br>")
    End If

    if ContactUs_Captcha = "" Then
        IsError = "Yes"
        Response.Write("<font color=""red"">Captcha Required.</font><br>")
    End If

End If

' If there were no input errors and the action of the form is "SendEMail" we send the email off
If Action = "SendEmail" And IsError <> "Yes" Then

    Dim strBody

    ' Here we create a nice looking html body for the email
    strBody = strBody & "<font face=""Arial"">Contact Us Form submitted at " & Now() &  vbCrLf & "<br><br>"
    strBody = strBody & "From http://" & Request.ServerVariables("HTTP_HOST") &  vbCrLf & "<br>"
    strBody = strBody & "IP " & Request.ServerVariables("REMOTE_ADDR") & vbCrLf & "<br>"
    strBody = strBody & "Name" & " : " & " " & Replace(ContactUs_Name,vbCr,"<br>") & "<br>"
    strBody = strBody & "Email" & " : " & " " & Replace(ContactUs_Email,vbCr,"<br>") & "<br>"
    strBody = strBody & "Subject" & " : " & " " & Replace(ContactUs_Subject,vbCr,"<br>") & "<br>"
    strBody = strBody & "<br>" & Replace(ContactUs_Body,vbCr,"<br>") & "<br>"
    strBody = strBody & "</font>"

    Dim ObjSendMail
    Set ObjSendMail = CreateObject("CDO.Message") 

    'This section provides the configuration information for the remote SMTP server.

    ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
    ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpserver
    ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 
    ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
    ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

    ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
    ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = youremail
    ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = yourpassword

    ObjSendMail.Configuration.Fields.Update

    'End remote SMTP server configuration section==

    ObjSendMail.To = youremail
    ObjSendMail.Subject = ContactUs_Subject
    ObjSendMail.From = ContactUs_Email

    ' we are sending a html email.. simply switch the comments around to send a text email instead
    ObjSendMail.HTMLBody = strBody
    'ObjSendMail.TextBody = strBody

    ObjSendMail.Send

    Set ObjSendMail = Nothing 

' change the success messages below to say or do whatever you like
' you could do a response.redirect or offer a hyperlink somewhere.. etc etc
%>
0)和(InStr(1,电子邮件“.”>0)然后
atCount=0
SpecialFlag=False
对于atLoop=1至Len(电子邮件)
atChr=Mid(电子邮件、atLoop、1)
如果ATCR=“@”,则atCount=atCount+1
如果(atChr>=Chr(32))和(atChr=Chr(123)),则SpecialFlag=True
如果(atChr>=Chr(58))和(atChr=Chr(91))和(atChr

如果无法处理自定义错误页面,则可以使用“下一步错误恢复”来捕获错误,例如:

On Error Resume Next
    'Put your code in here



    'Write out error messages
    If err.number > 0 then
        response.write "Error: err.description & " on line number <strong>" & err.line & "</strong>"
    END IF
On Error Goto 0

..而神秘的错误信息是???内部错误?这是您的标准内部错误"内部服务器错误服务器遇到内部错误或配置错误,无法完成您的请求。请与服务器管理员联系,告知错误发生的时间以及可能导致错误的任何操作。有关此错误的详细信息,请参阅服务器错误日志g、 “从这里开始:我现在无法打开调试器,这就是为什么我在这里发布帖子,看看是否有其他问题或建议。对不起,可能会出错的事情太多了。您只需打开详细的错误消息,否则您最好放弃。
        If (atCount = 1) And (SpecialFlag = False) Then
            BadFlag = False
            tAry1 = Split(Email, "@")
            UserName = tAry1(0)
            DomainName = tAry1(1)