使用 VB Script 的反馈表 - 剪掉垃圾邮件

问题描述

我有一个简单的经典 ASP 反馈表单,但它受到垃圾邮件的影响。所有代码都是客户端,我相信这个想法是对 BOTS 隐藏电子邮件地址。虽然我在原则上理解蜜罐的概念,但我不明白如何调整下面的代码来实现这一点。希望有一个相对简单的修复,而无需进行大量修改。任何帮助表示赞赏...

<% 
ErrorStatus = 0
ErrorMessage = ""
If Trim(Request("comment")) + "" = "" Then
    ErrorStatus = 1
    ErrorMessage = "Please provide a non-blank comment"
ElseIf Request("name") + "" = "" Then
    ErrorStatus = 2
    ErrorMessage = "Please provide a non-blank name"
ElseIf Trim(Request("email")) + "" = "" Then
    ErrorStatus = 3
    ErrorMessage = "Please provide a non-blank e-mail address"
ElseIf Trim(Request("email")) & "" <> "" and InStr(Request("email"),chr(64)) = 0 Then
    ErrorStatus = 4
    ErrorMessage = "Please enter a valid e-mail address"
End If
If ErrorStatus > 0 Then %>
<form action="Feedback.asp" method="post">
<input type="hidden" name="action" value="send">
<br>
<FONT FACE="Arial,Helvetica,Verdana" COLOR="red"><b><DIV CLASS="h1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* <%= ErrorMessage %> *</DIV></b></FONT>
<br>
<FONT FACE="Arial,Verdana" COLOR="gainsboro">
<DIV CLASS="h2_30">
<p>Your Name:
<br>
<input name="name" size=35 value="<%= Request("name")%>">
<p>Your E-Mail Address:
<br>
<input name="email" size=35 value="<%= Request("email")%>">
<p>Your Comments:
<br>
<textarea name="comment" cols=50 rows=7><%= Request("comment") %></textarea>
<p><input type="submit" value="Send Mail">
</FONT>
</DIV>
<br>
<DIR>
<FONT FACE="Arial,Verdana" COLOR="#ffd700">
<DIV CLASS="h3">
<b>* All fields required</b>
</DIV>
</FONT>
</DIR>
</form>
<% Else  
  strBody = Request("comment") & Chr(13) & Chr(10) & Chr(13) & Chr(10)
  strBody = strBody & Request("name") & Chr(13) & Chr(10) & Request("email") & Chr(13) & Chr(10)

  Set objMessage = CreateObject("cdo.message")
  objMessage.Sender =  Request("name")
  objMessage.From =  Request("email")
  objMessage.TextBody = strBody 
  objMessage.To = "email@email.com"
  objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
  objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
  objMessage.Configuration.Fields.Update

  On Error Resume Next
  objMessage.Send

  Response.Write "<BR><FONT FACE=Arial,Verdana COLOR=gainsboro><DIV CLASS=h2_10B><DIV CLASS=h2_10B><DIV CLASS=h2_10B><p>Feedback Sent!</p></DIV></DIV></DIV></FONT>"
  set objMessage = nothing

  End If %>
<% End Sub %>
<% Sub GetInfo %>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)