<%@ LANGUAGE="VBSCRIPT" %> <% Option Explicit %> <% Dim i, j, br, lf Dim iByteCount, sData, sTemp, bResponse, sEnd Dim sTo, sFrom, sSubject, sBody, bDataOK, sWebBody, sMessage Dim sFromField, bFromField, sRedirect, bRedirect, bRedirectIsSecure Dim aData, aPermit(), iCount, sLeadIn br = "
" lf = Chr(13) & Chr(10) sLeadIn = "The following information was sent:" 'Grab data from header in byte forma iByteCount = Request.TotalBytes sTemp = Request.BinaryRead(iByteCount) 'Convert byte data into string data For i = 1 to iByteCount sData = sData & Chr(AscB(MidB(sTemp,i,1))) Next 'Replace Query String substitution characters sData = Replace(sData, "+", " ") sData = Replace(sData, "=", ": ") 'Put each value into individual array element aData = Split(sData, "&", -1, 1) 'Get count of number of entries On Error Resume Next i = 0 iCount = 0 Do If NOT IsEmpty(aData(i)) then if Err.Number = 0 then iCount = iCount+1 Else Exit Do End If end If i=i+1 Loop 'Replace UUEncoding For i = 0 to iCount-1 aData(i) = Replace(aData(i), "%21", Chr(33)) '! aData(i) = Replace(aData(i), "%22", Chr(34)) '" aData(i) = Replace(aData(i), "%23", Chr(35)) '# aData(i) = Replace(aData(i), "%24", Chr(36)) '$ aData(i) = Replace(aData(i), "%25", Chr(37)) '% aData(i) = Replace(aData(i), "%26", Chr(38)) '& aData(i) = Replace(aData(i), "%27", Chr(39)) '' aData(i) = Replace(aData(i), "%28", Chr(40)) '( aData(i) = Replace(aData(i), "%29", Chr(41)) ') aData(i) = Replace(aData(i), "%2A", Chr(42)) '* aData(i) = Replace(aData(i), "%2B", Chr(43)) '+ aData(i) = Replace(aData(i), "%2C", Chr(44)) ', aData(i) = Replace(aData(i), "%2D", Chr(45)) '- aData(i) = Replace(aData(i), "%2E", Chr(46)) '. aData(i) = Replace(aData(i), "%2F", Chr(47)) '/ aData(i) = Replace(aData(i), "%3A", Chr(58)) ': aData(i) = Replace(aData(i), "%3B", Chr(59)) '; aData(i) = Replace(aData(i), "%3C", Chr(60)) '< aData(i) = Replace(aData(i), "%3D", Chr(61)) '= aData(i) = Replace(aData(i), "%3E", Chr(62)) '> aData(i) = Replace(aData(i), "%3F", Chr(63)) '? aData(i) = Replace(aData(i), "%40", Chr(64)) '@ aData(i) = Replace(aData(i), "%5B", Chr(91)) '[ aData(i) = Replace(aData(i), "%5C", Chr(92)) '\ aData(i) = Replace(aData(i), "%5D", Chr(93)) '] aData(i) = Replace(aData(i), "%5E", Chr(94)) '^ aData(i) = Replace(aData(i), "%5F", Chr(95)) '_ aData(i) = Replace(aData(i), "%60", Chr(96)) '' aData(i) = Replace(aData(i), "%7B", Chr(123)) '{ aData(i) = Replace(aData(i), "%7C", Chr(123)) '| aData(i) = Replace(aData(i), "%7D", Chr(123)) '} aData(i) = Replace(aData(i), "%7E", Chr(123)) '~ aData(i) = Replace(aData(i), "%0D", Chr(13)) 'Carriage Return aData(i) = Replace(aData(i), "%0A", Chr(10)) 'Line Feed Next Redim aPermit(iCount) For i = 0 to iCount-1 aPermit(i) = True If Left(aData(i),Len("MailTo")) = "MailTo" Then sTo = Mid(aData(i),Len("MailTo")+3) ' Response.write i & " Found MailTo: " & sTo & "
" aPermit(i) = False End If If Left(aData(i),Len("MailFromDefault")) = "MailFromDefault" Then sFrom = Mid(aData(i),Len("MailFromDefault")+3) aPermit(i) = False ' Response.write i & " Found MailFromDefault: " & sFrom & "
" aPermit(i) = False End If If Left(aData(i),Len("MailFromField")) = "MailFromField" Then sFromField = Mid(aData(i),Len("MailFromField")+3) ' Response.write i & " Found MailFromField: " & sFromField & "
" bFromField = True aPermit(i) = False End If If Left(aData(i),Len("MailSubject")) = "MailSubject" Then sSubject = Mid(aData(i),Len("MailSubject")+3) ' Response.write i & " Found MailSubject: " & sSubject & "
" aPermit(i) = False End If If Left(aData(i),Len("MailRedirect")) = "MailRedirect" Then sRedirect = "http://" & Mid(aData(i),Len("MailRedirect")+3) ' Response.write i & " Found MailRedirect: " & sRedirect & "
" bRedirect = True aPermit(i) = False End If If Left(aData(i),Len("MailRedirectSecure")) = "MailRedirectSecure" Then sRedirect = "https://" & Mid(aData(i),Len("MailRedirectSecure")+3) ' Response.write i & " Found MailRedirectSecure: " & sRedirect & "
" bRedirect = True aPermit(i) = False End If If Left(aData(i),Len("MailLeadIn")) = "MailLeadIn" Then 'Only Assign if NOT blank If Mid(aData(i),Len("MailLeadIn")+3) <> 0 then sLeadIn = Mid(aData(i),Len("MailLeadIn")+3) End If aPermit(i) = False ' Response.write i & " Found MailLeadIn: " & sLeadIn & "
" End If Next 'if MailFromField = true, then find FromField Value If bFromField = True Then For i = 0 to iCount-1 If Left(aData(i),Len(sFromField)) = sFromField Then 'Only Assign if NOT blank (3 is necessary to remove filler) '***This Section could use some work ensuring email is valid - like ...,; etc *** If Len(Trim(Mid(aData(i),Len(sFromField)+3))) > 0 then sFrom = Mid(aData(i),Len(sFromField)+3) End If End If Next End If 'Create Body of Message sBody = sLeadIn & lf & lf For i = 0 to iCount-1 If aPermit(i) = True Then sBody = sBody & aData(i) & lf End If Next 'Check that there is enough data to send mail bDataOK = True If len(sFrom) = 0 Then bDataOK = False sMessage = "No FROM Element.
" End If If len(sTo) = 0 Then bDataOK = False sMessage = "No TO Element.
" End If If len(sSubject) = 0 Then bDataOK = False sMessage = "No SUBJECT Element.
" End If If len(sBody) = 0 Then bDataOK = False sMessage = "No BODY Content.
" End If ' Response.Write "To: " & sTo & br ' Response.Write "From: " & sFrom & br ' Response.Write "Subject: " & sSubject & br ' Response.Write "Body:
" & sWebBody If bDataOK = False Then %> An Error Occurred

An Error Occurred:

An Error Occured with this application (Insufficient Data). Please Contact The System Administrator of this website. The form you filled out was NOT configured correctly.
 

ERROR:
<%= sMessage%>

If you should see this message, PLEASE click HERE to notify the hostmaster that a problem occurred. Include the name of the website that this error occurred on. It will keep others from having this problem. We apologise that you took the time to fill out this form and that it was NOT delivered due to this site's inability to test their software before implementing it.

<% Else 'Mail It sResult = mailIt(sFrom,sTo,sSubject,sBody) 'If redirecting to another page, redirect before anything is written to page If bRedirect = True then Response.Redirect sRedirect End If %> Form Results <% 'Print out the Message sWebBody = Cr2BR(sBody) Response.Write sWebBody End If %>