% Option Explicit '--------------------------------- ' Constant variables '--------------------------------- Const FileExt = ".txt" 'Const ValidEmailFolder = "/clients/javascript.nu/wwwroot/cgi4free/emailaddresses/validaddresses/" Const ValidEmailFolder = "\cgi4free\emailaddresses\validaddresses\" 'Unescaping \ is not necessary Const RedirectUrlWhenPostNotUsed = "http://www.javascript.nu/cgi4free/" Const ShowAds = True '--------------------------------- ' Form variables '--------------------------------- Dim MsgMsgSent Dim MsgInformationIsBelow Dim MsgClickToContinue Dim MsgSignUpCGI4Free Dim SendTo Dim SendCC Dim SendBCC Dim From Dim Subject Dim Priority Dim BodyFormat Dim MailFormat Dim Redirect Dim Language Dim CustomTextColor Dim CustomLinkColor Dim CustomVlinkColor Dim CustomBackgroundColor Dim CustomBody 'This will always be set and the value it gets depend on the "CustomXXX" variables above Dim InvalidAddress Dim IPAddress Dim CurrentTime Dim CurrentDate Dim ReservedFormFields Dim ColorHexCode SendTo = Request.Form("to") SendCC = Request.Form("cc") SendBCC = Request.Form("bcc") From = Request.Form("from") Subject = Request.Form("subject") Redirect = Request.Form("redirect") Language = LCase(Request.Form("language")) CustomTextColor = LCase(Request.Form("custom_textcolor")) CustomLinkColor = LCase(Request.Form("custom_linkcolor")) CustomVlinkColor = LCase(Request.Form("custom_vlinkcolor")) CustomBackgroundColor = LCase(Request.Form("custom_backgroundcolor")) IPAddress = Request.ServerVariables("REMOTE_HOST") CurrentTime = time() CurrentDate = date() Set ReservedFormFields=Server.CreateObject("Scripting.Dictionary") Set ColorHexCode=Server.CreateObject("Scripting.Dictionary") '--------------------------------- ' Set values to constant hash tables '--------------------------------- Sub SetValuesToConstantHashTables ReservedFormFields.Add "to","" ReservedFormFields.Add "cc","" ReservedFormFields.Add "bcc","" ReservedFormFields.Add "from","" ReservedFormFields.Add "subject","" ReservedFormFields.Add "type","" ReservedFormFields.Add "priority","" ReservedFormFields.Add "custom_textcolor","" ReservedFormFields.Add "custom_linkcolor","" ReservedFormFields.Add "custom_vlinkcolor","" ReservedFormFields.Add "custom_backgroundcolor","" ReservedFormFields.Add "redirect","" ReservedFormFields.Add "language","" ColorHexCode.Add "black","000000" ColorHexCode.Add "navy","000080" ColorHexCode.Add "darkblue","00008b" ColorHexCode.Add "mediumblue","0000cd" ColorHexCode.Add "blue","0000ff" ColorHexCode.Add "darkgreen","006400" ColorHexCode.Add "green","008000" ColorHexCode.Add "teal","008080" ColorHexCode.Add "darkcyan","008b8b" ColorHexCode.Add "deepskyblue","00bfbf" ColorHexCode.Add "darkturquoise","00ced1" ColorHexCode.Add "mediumspringgreen","00fa9a" ColorHexCode.Add "lime","00ff00" ColorHexCode.Add "springgreen","00ff7f" ColorHexCode.Add "aqua","00ffff" ColorHexCode.Add "cyan","00ffff" ColorHexCode.Add "midnightblue","191970" ColorHexCode.Add "dodgerblue","1e90ff" ColorHexCode.Add "lightseagreen","20b2aa" ColorHexCode.Add "forestgreen","228b22" ColorHexCode.Add "seagreen","2e8b57" ColorHexCode.Add "darkslategray","2f4f4f" ColorHexCode.Add "limegreen","32cd32" ColorHexCode.Add "mediumseagreen","3cb371" ColorHexCode.Add "turquoise","40e0d0" ColorHexCode.Add "royalblue","4169e1" ColorHexCode.Add "steelblue","4682b4" ColorHexCode.Add "darkslateblue","483d8b" ColorHexCode.Add "mediumturquoise","48d1cc" ColorHexCode.Add "indigo","4b0082" ColorHexCode.Add "darkolivegreen","556b2f" ColorHexCode.Add "cadetblue","5f9ea0" ColorHexCode.Add "cornflowerblue","6495ed" ColorHexCode.Add "mediumaquamarine","66cdaa" ColorHexCode.Add "dimgray","696969" ColorHexCode.Add "slateblue","6a5acd" ColorHexCode.Add "olivedrab","6b8e23" ColorHexCode.Add "slategray","708090" ColorHexCode.Add "lightslategray","778899" ColorHexCode.Add "mediumslateblue","7b68ee" ColorHexCode.Add "lawngreen","7cfc00" ColorHexCode.Add "chartreuse","7fff00" ColorHexCode.Add "aquamarine","7fffd4" ColorHexCode.Add "maroon","800000" ColorHexCode.Add "purple","800080" ColorHexCode.Add "olive","808000" ColorHexCode.Add "gray","808080" ColorHexCode.Add "skyblue","87ceeb" ColorHexCode.Add "lightskyblue","87cefa" ColorHexCode.Add "blueviolet","8a2be2" ColorHexCode.Add "darkred","8b0000" ColorHexCode.Add "darkmagenta","8b008b" ColorHexCode.Add "saddlebrown","8b4513" ColorHexCode.Add "darkseagreen","8fbc8f" ColorHexCode.Add "lightgreen","90ee90" ColorHexCode.Add "mediumpurple","9370db" ColorHexCode.Add "darkviolet","9400d3" ColorHexCode.Add "palegreen","98fb98" ColorHexCode.Add "darkorchid","9932cc" ColorHexCode.Add "yellowgreen","9acd32" ColorHexCode.Add "sienna","a0522d" ColorHexCode.Add "brown","a52a2a" ColorHexCode.Add "darkgray","a9a9a9" ColorHexCode.Add "lightblue","add8e6" ColorHexCode.Add "greenyellow","adff2f" ColorHexCode.Add "paleturquoise","afeeee" ColorHexCode.Add "lightsteelblue","b0c4de" ColorHexCode.Add "powderblue","b0e0e6" ColorHexCode.Add "firebrick","b22222" ColorHexCode.Add "darkgoldenrod","b8860b" ColorHexCode.Add "mediumorchid","ba55d3" ColorHexCode.Add "rosybrown","bc8f8f" ColorHexCode.Add "darkkhaki","bdb76b" ColorHexCode.Add "silver","c0c0c0" ColorHexCode.Add "mediumvioletred","c71585" ColorHexCode.Add "indianred","cd5c5c" ColorHexCode.Add "peru","cd853f" ColorHexCode.Add "chocolate","d2691e" ColorHexCode.Add "tan","d2b48c" ColorHexCode.Add "lightgray","d3d3d3" ColorHexCode.Add "thistle","d8bfd8" ColorHexCode.Add "orchid","da70d6" ColorHexCode.Add "goldenrod","daa520" ColorHexCode.Add "palevioletred","db7093" ColorHexCode.Add "crimson","dc143c" ColorHexCode.Add "gainsboro","dcdcdc" ColorHexCode.Add "plum","dda0dd" ColorHexCode.Add "burlywood","deb887" ColorHexCode.Add "lightcyan","e0ffff" ColorHexCode.Add "lavender","e6e6fa" ColorHexCode.Add "darksalmon","e9967a" ColorHexCode.Add "violet","ee82ee" ColorHexCode.Add "palegoldenrod","eee8aa" ColorHexCode.Add "lightcoral","f08080" ColorHexCode.Add "khaki","f0e68c" ColorHexCode.Add "aliceblue","f0f8ff" ColorHexCode.Add "honeydew","f0fff0" ColorHexCode.Add "azure","f0ffff" ColorHexCode.Add "sandybrown","f4a460" ColorHexCode.Add "wheat","f5deb3" ColorHexCode.Add "beige","f5f5dc" ColorHexCode.Add "whitesmoke","f5f5f5" ColorHexCode.Add "mintcream","f5fffa" ColorHexCode.Add "ghostwhite","f8f8ff" ColorHexCode.Add "salmon","fa8072" ColorHexCode.Add "antiquewhite","faebd7" ColorHexCode.Add "linen","faf0e6" ColorHexCode.Add "lightgoldenrodyellow","fafad2" ColorHexCode.Add "oldlace","fdf5e6" ColorHexCode.Add "red","ff0000" ColorHexCode.Add "fuchsia","ff00ff" ColorHexCode.Add "magenta","ff00ff" ColorHexCode.Add "deeppink","ff1493" ColorHexCode.Add "orangered","ff4500" ColorHexCode.Add "tomato","ff6347" ColorHexCode.Add "hotpink","ff69b4" ColorHexCode.Add "coral","ff7f50" ColorHexCode.Add "darkorange","ff8c00" ColorHexCode.Add "lightsalmon","ffa07a" ColorHexCode.Add "orange","ffa500" ColorHexCode.Add "lightpink","ffb6c1" ColorHexCode.Add "pink","ffc0cb" ColorHexCode.Add "gold","ffd700" ColorHexCode.Add "peachpuff","ffdab9" ColorHexCode.Add "navajowhite","ffdead" ColorHexCode.Add "moccasin","ffe4b5" ColorHexCode.Add "bisque","ffe4c4" ColorHexCode.Add "mistyrose","ffe4e1" ColorHexCode.Add "blanchedalmond","ffebcd" ColorHexCode.Add "papayawhip","ffefd5" ColorHexCode.Add "lavenderblush","fff0f5" ColorHexCode.Add "seashell","fff5ee" ColorHexCode.Add "cornsilk","fff8dc" ColorHexCode.Add "lemonchiffon","fffacd" ColorHexCode.Add "floralwhite","fffaf0" ColorHexCode.Add "snow","fffafa" ColorHexCode.Add "yellow","ffff00" ColorHexCode.Add "lightyellow","ffffe0" ColorHexCode.Add "ivory","fffff0" ColorHexCode.Add "white","ffffff" End Sub '----------------------------------------------- ' Set the variables that need to be converted '----------------------------------------------- Sub SetVariables 'Set mail priority '0:low; 1:medel; 2:high priority If LCase(Request.Form("priority")) = "high" Then Priority = "2" ElseIf LCase(Request.Form("priority")) = "low" Then Priority = "0" Else Priority = "1" End If 'Set mail type (text or HTML) 'BodyFormat: 1:plain text; 0:HTML format 'MailFormat: If this is 1 long lines will automatically line break. This MUST be 0 if we want be able to send mail in HTML-format (otherwise the tags will be shown as plain text) If LCase(Request.Form("type")) = "text" Then BodyFormat = "1" MailFormat = "0" ElseIf LCase(Request.Form("type")) = "text_shortlines" Then BodyFormat = "1" MailFormat = "1" Else BodyFormat = "0" MailFormat = "0" End If If Subject = "" Then Subject = "Cgi4Free Formmail" End If If Redirect = "" Then Redirect = "http://www.javascript.nu/cgi4free/formmail/thanks.shtml" End If If Language = "swedish" Then MsgMsgSent = "Meddelandet skickat!" MsgInformationIsBelow = "Nedan kan du se vilken information som skickats." MsgClickToContinue = "Tryck här för att ta dig vidare" MsgSignUpCGI4Free = "Registrera dig för ditt eget Formmail script." Else MsgMsgSent = "Message Sent!" MsgInformationIsBelow = "The information you have submitted is shown below." MsgClickToContinue = "Click here to continue" MsgSignUpCGI4Free = "Sign up for your own free Formmail script." End If 'All CustomXXX values have already been converted to lower case If ColorHexCode.Exists(CustomTextColor) = True Then CustomTextColor = ColorHexCode.Item(CustomTextColor) Else CustomTextColor = ColorHexCode.Item("black") End If If ColorHexCode.Exists(CustomLinkColor) = True Then CustomLinkColor = ColorHexCode.Item(CustomLinkColor) Else CustomLinkColor = ColorHexCode.Item("blue") End If If ColorHexCode.Exists(CustomVlinkColor) = True Then CustomVlinkColor = ColorHexCode.Item(CustomVlinkColor) Else CustomVlinkColor = ColorHexCode.Item("red") End If If ColorHexCode.Exists(CustomBackgroundColor) = True Then CustomBackgroundColor = ColorHexCode.Item(CustomBackgroundColor) Else CustomBackgroundColor = ColorHexCode.Item("white") End If If From = "" Then From = "noemail@noemail.com" End If CustomBody = "
" End Sub '--------------------------------- ' Returns true iff Filename exist. '--------------------------------- Function FileExist(Filename) ' Create a filesystem object Dim FSO set FSO = server.createObject("Scripting.FileSystemObject") ' Map the logical path to the physical system path Dim Filepath Filepath = Server.MapPath(Filename) 'Basically adds "d:\clients\javascript.nu\wwwroot" to the path FileExist = FSO.FileExists(Filepath) Set FSO = nothing End Function '--------------------------------- ' "abc@def.com" ==> "abc_a_def.com.txt" '--------------------------------- Function GetEmailWithFileNameFormat(Email) GetEmailWithFileNameFormat = Replace(Email, "@", "_a_") & FileExt End Function '----------------------------------------------- ' Exit execution if too much data is being sent. '----------------------------------------------- Sub ExitIfTooMuchDataIsBeingSent If Request.TotalBytes > 1000000 Then 'If the user tries to send more than 1 mb of data, then terminate execution Response.Write "Too much data is being sent." Response.Write "
|
"
Response.Write ""
If SendTo <> "" Then
Response.Write "You are not allowed to send an email to " & InvalidAddress & ". "
Response.Write " "
Response.Write "However, if " & InvalidAddress & " is your e-mail you can sign up for a free Cgi4Free account and start sending mail to " & InvalidAddress & " using this form. "
Response.Write " "
Response.Write " |
<%=MsgMsgSent%>
<%=MsgInformationIsBelow%>
") Response.Write "" & FieldName & " " & FieldValue Response.Write " "
End If
Next
%>
|